mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 12:29:55 +08:00
14
gulpfile.js
14
gulpfile.js
@ -876,3 +876,17 @@ gulp.task('tooling', function(){
|
|||||||
.pipe(gulp.dest('dist'));
|
.pipe(gulp.dest('dist'));
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TS LINT
|
||||||
|
*/
|
||||||
|
gulp.task("tslint", function() {
|
||||||
|
var tslint = require("gulp-tslint");
|
||||||
|
gulp.src([
|
||||||
|
'ionic/**/*.ts',
|
||||||
|
'!ionic/components/*/test/**/*',
|
||||||
|
'!ionic/util/test/*'
|
||||||
|
]).pipe(tslint())
|
||||||
|
.pipe(tslint.report('verbose'));
|
||||||
|
});
|
||||||
|
@ -179,7 +179,7 @@ export class Animation {
|
|||||||
if (!isNaN(num)) {
|
if (!isNaN(num)) {
|
||||||
fxState.num = num;
|
fxState.num = num;
|
||||||
}
|
}
|
||||||
fxState.unit = (r[0] != r[2] ? r[2] : '');
|
fxState.unit = (r[0] !== r[2] ? r[2] : '');
|
||||||
|
|
||||||
} else if (typeof val === 'number') {
|
} else if (typeof val === 'number') {
|
||||||
fxState.num = val;
|
fxState.num = val;
|
||||||
@ -216,7 +216,7 @@ export class Animation {
|
|||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
get after() {
|
get after() {
|
||||||
@ -239,7 +239,7 @@ export class Animation {
|
|||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
play(opts: PlayOptions = {}) {
|
play(opts: PlayOptions = {}) {
|
||||||
@ -818,10 +818,10 @@ interface EffectState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const TRANSFORMS = {
|
const TRANSFORMS = {
|
||||||
'translateX':1, 'translateY':1, 'translateZ':1,
|
'translateX': 1, 'translateY': 1, 'translateZ': 1,
|
||||||
'scale':1, 'scaleX':1, 'scaleY':1, 'scaleZ':1,
|
'scale': 1, 'scaleX': 1, 'scaleY': 1, 'scaleZ': 1,
|
||||||
'rotate':1, 'rotateX':1, 'rotateY':1, 'rotateZ':1,
|
'rotate': 1, 'rotateX': 1, 'rotateY': 1, 'rotateZ': 1,
|
||||||
'skewX':1, 'skewY':1, 'perspective':1
|
'skewX': 1, 'skewY': 1, 'perspective': 1
|
||||||
};
|
};
|
||||||
|
|
||||||
const CSS_VALUE_REGEX = /(^-?\d*\.?\d*)(.*)/;
|
const CSS_VALUE_REGEX = /(^-?\d*\.?\d*)(.*)/;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import {ElementRef} from 'angular2/core';
|
import {ElementRef} from 'angular2/core';
|
||||||
import * as dom from '../util/dom';
|
import * as dom from '../util/dom';
|
||||||
|
|
||||||
let ids:number = 0;
|
let ids: number = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class for all Ionic components. Exposes some common functionality
|
* Base class for all Ionic components. Exposes some common functionality
|
||||||
|
@ -20,7 +20,7 @@ import {Translate} from '../translation/translate';
|
|||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
export function ionicProviders(args: any={}) {
|
export function ionicProviders(args: any = {}) {
|
||||||
let platform = new Platform();
|
let platform = new Platform();
|
||||||
let navRegistry = new NavRegistry(args.pages);
|
let navRegistry = new NavRegistry(args.pages);
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ import {TapClick} from '../components/tap-click/tap-click';
|
|||||||
import {ionicProviders} from '../config/bootstrap';
|
import {ionicProviders} from '../config/bootstrap';
|
||||||
import {IONIC_DIRECTIVES} from '../config/directives';
|
import {IONIC_DIRECTIVES} from '../config/directives';
|
||||||
|
|
||||||
const _reflect: any=Reflect;
|
const _reflect: any = Reflect;
|
||||||
|
|
||||||
export interface AppMetadata {
|
export interface AppMetadata {
|
||||||
prodMode?: boolean;
|
prodMode?: boolean;
|
||||||
@ -64,7 +64,7 @@ export interface AppMetadata {
|
|||||||
* @property {string} [template] - the template to use for the app root.
|
* @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.
|
* @property {string} [templateUrl] - a relative URL pointing to the template to use for the app root.
|
||||||
*/
|
*/
|
||||||
export function App(args: AppMetadata={}) {
|
export function App(args: AppMetadata = {}) {
|
||||||
|
|
||||||
return function(cls) {
|
return function(cls) {
|
||||||
// get current annotations
|
// get current annotations
|
||||||
@ -100,5 +100,5 @@ export function App(args: AppMetadata={}) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
return cls;
|
return cls;
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import {Component, ChangeDetectionStrategy, ViewEncapsulation, Type} from 'angular2/core'
|
import {Component, ChangeDetectionStrategy, ViewEncapsulation, Type} from 'angular2/core';
|
||||||
import {IONIC_DIRECTIVES} from '../config/directives';
|
import {IONIC_DIRECTIVES} from '../config/directives';
|
||||||
|
|
||||||
const _reflect: any=Reflect;
|
const _reflect: any = Reflect;
|
||||||
|
|
||||||
export interface PageMetadata {
|
export interface PageMetadata {
|
||||||
selector?: string;
|
selector?: string;
|
||||||
@ -107,5 +107,5 @@ export function Page(config: PageMetadata) {
|
|||||||
annotations.push(new Component(config));
|
annotations.push(new Component(config));
|
||||||
_reflect.defineMetadata('annotations', annotations, cls);
|
_reflect.defineMetadata('annotations', annotations, cls);
|
||||||
return cls;
|
return cls;
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ export class Gesture {
|
|||||||
}
|
}
|
||||||
|
|
||||||
on(type: string, cb: Function) {
|
on(type: string, cb: Function) {
|
||||||
if(type == 'pinch' || type == 'rotate') {
|
if (type === 'pinch' || type === 'rotate') {
|
||||||
this._hammer.get('pinch').set({enable: true});
|
this._hammer.get('pinch').set({enable: true});
|
||||||
}
|
}
|
||||||
this._hammer.on(type, cb);
|
this._hammer.on(type, cb);
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
/* tslint:disable */
|
||||||
import {assign} from '../util/util';
|
import {assign} from '../util/util';
|
||||||
|
|
||||||
const win: any = window;
|
const win: any = window;
|
||||||
|
@ -25,14 +25,14 @@ import {Config} from '../config/config';
|
|||||||
*/
|
*/
|
||||||
export class Platform {
|
export class Platform {
|
||||||
private _platforms: Array<string>;
|
private _platforms: Array<string>;
|
||||||
private _versions: any={};
|
private _versions: any = {};
|
||||||
private _dir: string;
|
private _dir: string;
|
||||||
private _lang: string;
|
private _lang: string;
|
||||||
private _url: string;
|
private _url: string;
|
||||||
private _qs: any;
|
private _qs: any;
|
||||||
private _ua: string;
|
private _ua: string;
|
||||||
private _bPlt: string;
|
private _bPlt: string;
|
||||||
private _onResizes: Array<Function>=[];
|
private _onResizes: Array<Function> = [];
|
||||||
private _readyPromise: Promise<any>;
|
private _readyPromise: Promise<any>;
|
||||||
private _readyResolve: any;
|
private _readyResolve: any;
|
||||||
private _engineReady: any;
|
private _engineReady: any;
|
||||||
@ -43,7 +43,7 @@ export class Platform {
|
|||||||
*/
|
*/
|
||||||
platformOverride: string;
|
platformOverride: string;
|
||||||
|
|
||||||
constructor(platforms=[]) {
|
constructor(platforms = []) {
|
||||||
this._platforms = platforms;
|
this._platforms = platforms;
|
||||||
this._readyPromise = new Promise(res => { this._readyResolve = res; } );
|
this._readyPromise = new Promise(res => { this._readyResolve = res; } );
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ const OPACITY = 'opacity';
|
|||||||
const TRANSLATEX = 'translateX';
|
const TRANSLATEX = 'translateX';
|
||||||
const OFF_RIGHT = '99.5%';
|
const OFF_RIGHT = '99.5%';
|
||||||
const OFF_LEFT = '-33%';
|
const OFF_LEFT = '-33%';
|
||||||
const CENTER = '0%'
|
const CENTER = '0%';
|
||||||
const OFF_OPACITY = 0.8;
|
const OFF_OPACITY = 0.8;
|
||||||
const SHOW_BACK_BTN_CSS = 'show-back-button';
|
const SHOW_BACK_BTN_CSS = 'show-back-button';
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ import {ViewController} from '../components/nav/view-controller';
|
|||||||
|
|
||||||
const TRANSLATEY = 'translateY';
|
const TRANSLATEY = 'translateY';
|
||||||
const OFF_BOTTOM = '40px';
|
const OFF_BOTTOM = '40px';
|
||||||
const CENTER = '0px'
|
const CENTER = '0px';
|
||||||
const SHOW_BACK_BTN_CSS = 'show-back-button';
|
const SHOW_BACK_BTN_CSS = 'show-back-button';
|
||||||
|
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ export class Translate {
|
|||||||
|
|
||||||
translate(key, lang) {
|
translate(key, lang) {
|
||||||
// If the language isn't specified and we have no overridden one, return the string passed.
|
// If the language isn't specified and we have no overridden one, return the string passed.
|
||||||
if(!lang && !this._language) {
|
if (!lang && !this._language) {
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ export class Translate {
|
|||||||
|
|
||||||
let map = this.getTranslations(setLanguage);
|
let map = this.getTranslations(setLanguage);
|
||||||
|
|
||||||
if(!map) {
|
if (!map) {
|
||||||
console.warn('I18N: No translation for key', key, 'using language', setLanguage);
|
console.warn('I18N: No translation for key', key, 'using language', setLanguage);
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
@ -16,14 +16,14 @@ import {Translate} from './translate';
|
|||||||
@Pipe({name: 'translate'})
|
@Pipe({name: 'translate'})
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class TranslatePipe implements PipeTransform {
|
export class TranslatePipe implements PipeTransform {
|
||||||
private translate :any = {};
|
private translate: any = {};
|
||||||
|
|
||||||
constructor(translate: Translate) {
|
constructor(translate: Translate) {
|
||||||
this.translate = translate;
|
this.translate = translate;
|
||||||
}
|
}
|
||||||
transform(value, args) {
|
transform(value, args) {
|
||||||
let lang;
|
let lang;
|
||||||
if(args.length > 0) {
|
if (args.length > 0) {
|
||||||
lang = args[0];
|
lang = args[0];
|
||||||
}
|
}
|
||||||
return this.translate.translate(value, lang);
|
return this.translate.translate(value, lang);
|
||||||
|
@ -194,9 +194,9 @@ export function hasFocus(ele) {
|
|||||||
|
|
||||||
export function isTextInput(ele) {
|
export function isTextInput(ele) {
|
||||||
return !!ele &&
|
return !!ele &&
|
||||||
(ele.tagName == 'TEXTAREA' ||
|
(ele.tagName === 'TEXTAREA' ||
|
||||||
ele.contentEditable === 'true' ||
|
ele.contentEditable === 'true' ||
|
||||||
(ele.tagName == 'INPUT' && !(/^(radio|checkbox|range|file|submit|reset|color|image|button)$/i).test(ele.type)));
|
(ele.tagName === 'INPUT' && !(/^(radio|checkbox|range|file|submit|reset|color|image|button)$/i).test(ele.type)));
|
||||||
}
|
}
|
||||||
|
|
||||||
export function hasFocusedTextInput() {
|
export function hasFocusedTextInput() {
|
||||||
@ -207,7 +207,7 @@ export function hasFocusedTextInput() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const skipInputAttrsReg = /^(value|checked|disabled|type|class|style|id|autofocus|autocomplete|autocorrect)$/i
|
const skipInputAttrsReg = /^(value|checked|disabled|type|class|style|id|autofocus|autocomplete|autocorrect)$/i;
|
||||||
export function copyInputAttributes(srcElement, destElement) {
|
export function copyInputAttributes(srcElement, destElement) {
|
||||||
// copy attributes from one element to another
|
// copy attributes from one element to another
|
||||||
// however, skip over a few of them as they're already
|
// however, skip over a few of them as they're already
|
||||||
@ -222,7 +222,7 @@ export function copyInputAttributes(srcElement, destElement) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let matchesFn: string;
|
let matchesFn: string;
|
||||||
let matchesMethods: Array<string> = ['matches','webkitMatchesSelector','mozMatchesSelector','msMatchesSelector'];
|
let matchesMethods: Array<string> = ['matches', 'webkitMatchesSelector', 'mozMatchesSelector', 'msMatchesSelector'];
|
||||||
matchesMethods.some((fn: string) => {
|
matchesMethods.some((fn: string) => {
|
||||||
if (typeof document.documentElement[fn] === 'function') {
|
if (typeof document.documentElement[fn] === 'function') {
|
||||||
matchesFn = fn;
|
matchesFn = fn;
|
||||||
@ -299,4 +299,4 @@ export function flushDimensionCache() {
|
|||||||
dimensionCache = {};
|
dimensionCache = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
let dimensionCache:any = {};
|
let dimensionCache: any = {};
|
||||||
|
@ -70,7 +70,7 @@ export class Keyboard {
|
|||||||
* @param {function} callback method you want to call when the keyboard has been closed
|
* @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
|
* @return {function} returns a callback that gets fired when the keyboard is closed
|
||||||
*/
|
*/
|
||||||
onClose(callback, pollingInternval=KEYBOARD_CLOSE_POLLING) {
|
onClose(callback, pollingInternval = KEYBOARD_CLOSE_POLLING) {
|
||||||
console.debug('keyboard onClose');
|
console.debug('keyboard onClose');
|
||||||
const self = this;
|
const self = this;
|
||||||
let checks = 0;
|
let checks = 0;
|
||||||
@ -152,7 +152,7 @@ export class Keyboard {
|
|||||||
|
|
||||||
// default is to add the focus-outline when the tab key is used
|
// default is to add the focus-outline when the tab key is used
|
||||||
function keyDown(ev) {
|
function keyDown(ev) {
|
||||||
if (!isKeyInputEnabled && ev.keyCode == 9) {
|
if (!isKeyInputEnabled && ev.keyCode === 9) {
|
||||||
isKeyInputEnabled = true;
|
isKeyInputEnabled = true;
|
||||||
enableKeyInput();
|
enableKeyInput();
|
||||||
}
|
}
|
||||||
|
@ -74,11 +74,11 @@ export class ScrollView {
|
|||||||
// fraction based on the easing method
|
// fraction based on the easing method
|
||||||
let easedT = (--time) * time * time + 1;
|
let easedT = (--time) * time * time + 1;
|
||||||
|
|
||||||
if (fromY != y) {
|
if (fromY !== y) {
|
||||||
self.setTop((easedT * (y - fromY)) + fromY);
|
self.setTop((easedT * (y - fromY)) + fromY);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fromX != x) {
|
if (fromX !== x) {
|
||||||
self._el.scrollLeft = Math.floor((easedT * (x - fromX)) + fromX);
|
self._el.scrollLeft = Math.floor((easedT * (x - fromX)) + fromX);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,7 +134,9 @@ export const isCheckedProperty = function(a: any, b: any): boolean {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// not using strict comparison on purpose
|
// not using strict comparison on purpose
|
||||||
|
/* tslint:disable */
|
||||||
return (a == b);
|
return (a == b);
|
||||||
|
/* tslint:enable */
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -170,7 +172,7 @@ export const array = {
|
|||||||
arr.splice(index, 1);
|
arr.splice(index, 1);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Grab all query strings keys and values.
|
* Grab all query strings keys and values.
|
||||||
|
@ -52,6 +52,7 @@
|
|||||||
"gulp-sass": "^2.0.4",
|
"gulp-sass": "^2.0.4",
|
||||||
"gulp-shell": "^0.4.0",
|
"gulp-shell": "^0.4.0",
|
||||||
"gulp-strip-debug": "^1.1.0",
|
"gulp-strip-debug": "^1.1.0",
|
||||||
|
"gulp-tslint": "^4.3.4",
|
||||||
"gulp-typescript": "2.12.1",
|
"gulp-typescript": "2.12.1",
|
||||||
"gulp-util": "^3.0.6",
|
"gulp-util": "^3.0.6",
|
||||||
"gulp-watch": "^4.2.4",
|
"gulp-watch": "^4.2.4",
|
||||||
@ -79,6 +80,7 @@
|
|||||||
"strip-sourcemap-loader": "0.0.1",
|
"strip-sourcemap-loader": "0.0.1",
|
||||||
"systemjs": "0.19.6",
|
"systemjs": "0.19.6",
|
||||||
"through2": "^0.6.3",
|
"through2": "^0.6.3",
|
||||||
|
"tslint": "^3.7.1",
|
||||||
"typescript": "1.8.7",
|
"typescript": "1.8.7",
|
||||||
"vinyl": "^0.4.6",
|
"vinyl": "^0.4.6",
|
||||||
"webpack": "^1.12.2",
|
"webpack": "^1.12.2",
|
||||||
|
57
tslint.json
Normal file
57
tslint.json
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
{
|
||||||
|
"rules": {
|
||||||
|
"class-name": true,
|
||||||
|
"comment-format": [
|
||||||
|
true,
|
||||||
|
"check-space"
|
||||||
|
],
|
||||||
|
"indent": [
|
||||||
|
true,
|
||||||
|
"spaces"
|
||||||
|
],
|
||||||
|
"no-duplicate-variable": true,
|
||||||
|
"no-eval": true,
|
||||||
|
"no-internal-module": true,
|
||||||
|
"no-trailing-whitespace": true,
|
||||||
|
"no-var-keyword": false,
|
||||||
|
"one-line": [
|
||||||
|
true,
|
||||||
|
"check-open-brace",
|
||||||
|
"check-whitespace"
|
||||||
|
],
|
||||||
|
"quotemark": [
|
||||||
|
true,
|
||||||
|
"single"
|
||||||
|
],
|
||||||
|
"semicolon": [
|
||||||
|
true,
|
||||||
|
"always"
|
||||||
|
],
|
||||||
|
"triple-equals": [
|
||||||
|
true,
|
||||||
|
"allow-null-check"
|
||||||
|
],
|
||||||
|
"typedef-whitespace": [
|
||||||
|
true,
|
||||||
|
{
|
||||||
|
"call-signature": "nospace",
|
||||||
|
"index-signature": "nospace",
|
||||||
|
"parameter": "nospace",
|
||||||
|
"property-declaration": "nospace",
|
||||||
|
"variable-declaration": "nospace"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"variable-name": [
|
||||||
|
true,
|
||||||
|
"ban-keywords"
|
||||||
|
],
|
||||||
|
"whitespace": [
|
||||||
|
true,
|
||||||
|
"check-branch",
|
||||||
|
"check-decl",
|
||||||
|
"check-operator",
|
||||||
|
"check-separator",
|
||||||
|
"check-type"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user