Merge branch 'master' into searchbar-fix

# Conflicts:
#	ionic/components/searchbar/searchbar.ts
This commit is contained in:
Brandy Carney
2015-12-10 17:55:44 -05:00
parent ab4ad905a8
commit ff8169cb0a
84 changed files with 634 additions and 534 deletions

View File

@ -12,99 +12,44 @@ var tsc = require('gulp-typescript');
var cache = require('gulp-cached'); var cache = require('gulp-cached');
var minimist = require('minimist'); var minimist = require('minimist');
function getBabelOptions(moduleName, moduleType) {
return {
optional: ['es7.decorators'],
modules: moduleType || "system",
moduleIds: true,
getModuleId: function(name) {
if (moduleName == "e2e"){
return name.replace(/^.*\/test\/[^\/]*\//, '');
}
else if (moduleName == "demos"){
return name.replace(/^(.*?)\//, '')
}
return moduleName + '/' + name.split('/test').join('');
}
}
}
function buildDemoBundle(opts, done) {
var glob = require('glob');
var webpack = require('webpack');
var path = require('path');
var _ = require('lodash');
var numWebpacks = 0;
var fp = 'dist/demos/'+opts.demo+'/index.js';
if (opts.demo == 'api') {
fp = "dist/demos/**/index.js";
}
return glob(fp, function(err, files){
files.forEach(function(file){
var config = require('./scripts/demos/webpack.config.js');
// add our bundle entry, removing previous if necessary
// since config is cached
if (config.entry.length > 5) {
config.entry.pop();
}
config.entry.push('./' + file);
config.output = {
filename: path.dirname(file) + '/bundle.js'
}
// pretty sure this is a race, but it works
numWebpacks++;
webpack(config, function(err, stats){
// var statsOptions = {
// 'colors': true,
// 'modules': true,
// 'chunks': false,
// 'exclude': ['node_modules'],
// 'errorDetails': true
// }
// console.log(stats.toString(statsOptions));
if (--numWebpacks === 0) done();
})
})
});
}
var tscOptions = {
target: 'ES6',
allowNonTsExtensions: true,
isolatedModules: true,
emitDecoratorMetadata: true,
experimentalDecorators: true,
noEmitOnError: false, // ignore errors
rootDir: '.'
}
var tscReporter = {
error: function (error) {
console.error(error.message);
}
};
var flagConfig = { var flagConfig = {
string: ['port', 'version', 'ngVersion', 'animations'], string: ['port', 'version', 'ngVersion', 'animations'],
boolean: ['dry-run'], boolean: ['dry-run'],
alias: {'p': 'port', 'v': 'version', 'a': 'ngVersion'}, alias: {'p': 'port', 'v': 'version', 'a': 'ngVersion'},
default: { port: 8000 } default: { port: 8000 }
}; };
var flags = minimist(process.argv.slice(2), flagConfig); var flags = minimist(process.argv.slice(2), flagConfig);
var tscOptions = {
emitDecoratorMetadata: true,
experimentalDecorators: true,
target: "es5",
module: "commonjs",
declaration: true,
outDir: "dist"
}
var tscOptionsNoTypeCheck = {
emitDecoratorMetadata: true,
experimentalDecorators: true,
target: "es5",
module: "commonjs",
isolatedModules: true
}
var tscReporter = {
error: function (error) {
// TODO
// suppress type errors until we convert everything to TS
// console.error(error.message);
}
};
gulp.task('build', function(done) { gulp.task('build', function(done) {
runSequence( runSequence(
'copy.web-animations',
'bundle', 'bundle',
'e2e', ['e2e', 'sass', 'fonts'],
'sass',
'fonts',
done done
); );
}) })
@ -125,18 +70,7 @@ gulp.task('watch', function(done) {
], ],
function(file) { function(file) {
if (file.event === "unlink") { if (file.event === "unlink") {
var basePath = file.base.substring(0, file.base.lastIndexOf("ionic/")); deleteFile(file);
var relPath = file.history[0].replace(basePath, "").replace(".ts", ".js");
var es6Path = basePath + "dist/src/es6/" + relPath;
var commonPath = basePath + "dist/src/es5/common/" + relPath;
var systemPath = basePath + "dist/src/es5/system/" + relPath;
delete cache.caches.transpile[file.history[0]];
del([es6Path, commonPath, systemPath], function(){
gulp.start('bundle');
});
} else { } else {
gulp.start('bundle'); gulp.start('bundle');
} }
@ -144,22 +78,8 @@ gulp.task('watch', function(done) {
); );
watch('ionic/components/*/test/**/*', function(file) { watch('ionic/components/*/test/**/*', function(file) {
if (file.event === "unlink") {
var paths = file.history[0].split("ionic/components/");
var basePath = paths[0],
relPath = paths[1].split("/test").join("").replace(".ts", ".js");
var distPath = basePath + "dist/e2e/" + relPath;
delete cache.caches.e2e[file.history[0]];
del([distPath], function(){
gulp.start('e2e'); gulp.start('e2e');
}); });
} else {
gulp.start('e2e');
}
});
watch('ionic/**/*.scss', function() { watch('ionic/**/*.scss', function() {
gulp.start('sass'); gulp.start('sass');
@ -168,13 +88,25 @@ gulp.task('watch', function(done) {
done(); done();
} }
); );
});
function deleteFile(file) {
var basePath = file.base.substring(0, file.base.lastIndexOf("ionic/"));
var relativePath = file.history[0].replace(file.base, '').replace('.ts', '.js');
var filePath = basePath + 'dist/' + relativePath;
var typingPath = filePath.replace('.js', '.d.ts');
delete cache.caches.transpile[file.history[0]];
del([filePath, typingPath], function(){
gulp.start('bundle');
});
}
});
gulp.task('serve', function() { gulp.task('serve', function() {
var connect = require('gulp-connect'); var connect = require('gulp-connect');
connect.server({ connect.server({
root: 'dist',
port: flags.port, port: flags.port,
livereload: false livereload: false
}); });
@ -184,56 +116,74 @@ gulp.task('clean', function(done) {
del(['dist/**', '!dist'], done); del(['dist/**', '!dist'], done);
}); });
function transpile(moduleType) { function tsResult(options){
var stream = gulp.src([ return gulp.src([
'ionic/**/*.ts', 'ionic/**/*.ts',
'!ionic/components/*/test/**/*', '!ionic/components/*/test/**/*',
'!ionic/util/test/*' '!ionic/util/test/*'
]) ])
.pipe(cache('transpile', { optimizeMemory: true })) .pipe(cache('transpile', { optimizeMemory: true }))
.pipe(tsc(tscOptions, null, tscReporter)) .pipe(tsc(options, undefined, tscReporter))
.on('error', function(error) { .on('error', function(error) {
stream.emit('end'); console.log(error.message);
})
.pipe(gulp.dest('dist/src/es6/ionic'))
.pipe(babel(getBabelOptions('ionic', moduleType)))
.on('error', function (err) {
console.log("ERROR: " + err.message);
this.emit('end'); this.emit('end');
}) });
.pipe(gulp.dest('dist/src/es5/' + moduleType + '/ionic'))
return stream;
} }
gulp.task('transpile.no-typecheck', function(){
gulp.task('transpile.system', function() { return transpile("system"); }); return tsResult(tscOptionsNoTypeCheck)
gulp.task('transpile.common', function() { .pipe(gulp.dest('dist'));
// necessary for publish task, remove if we ever do incremental builds with cjs
cache.caches && delete cache.caches.transpile;
return transpile("common");
}); });
gulp.task('transpile', ['transpile.system']);
gulp.task('bundle.ionic', ['transpile'], function() { gulp.task('transpile.typecheck', function(){
var insert = require('gulp-insert'); var merge = require('merge2');
var concat = require('gulp-concat');
var prepend = []; var result = tsResult(tscOptions);
// force the web animations api polyfill to kick in // merge definition and source streams
if (flags.animations == 'polyfill') { return merge([
prepend.push('window.Element.prototype.animate=undefined;'); result.dts,
result.js
])
.pipe(gulp.dest('dist'));
})
gulp.task('transpile', ['transpile.no-typecheck']);
gulp.task('bundle', ['transpile'], function(done){
//TODO
// if (flags.animations == 'polyfill') {
// prepend.push('window.Element.prototype.animate=undefined;');
// }
var config = require('./scripts/npm/ionic.webpack.config.js');
bundle({
config: config,
cb: done,
stats: true
});
})
function bundle(args) {
var webpack = require('webpack');
var path = require('path');
var numTasks = args.numTasks ? args.numTasks : 0;
webpack(args.config, function(err, stats){
if (args.stats) {
var statsOptions = {
'colors': true,
'modules': false,
'chunks': false,
'exclude': ['node_module'],
'errorDetails': true
}
console.log(stats.toString(statsOptions));
} }
return gulp.src([ if (numTasks === 0 && args.cb) args.cb();
'node_modules/es6-shim/es6-shim.min.js', })
'dist/src/es5/system/ionic/**/*.js' }
])
.pipe(concat('ionic.js'))
.pipe(insert.prepend(prepend.join('\n')))
.pipe(gulp.dest('dist/js/'));
//TODO minify + sourcemaps
});
gulp.task('temp.hack', function(){ gulp.task('temp.hack', function(){
var fs = require('fs'); var fs = require('fs');
@ -262,17 +212,9 @@ gulp.task('temp.hack', function(){
fs.writeFileSync(file, myHackedFileThatYouLove, 'utf8'); fs.writeFileSync(file, myHackedFileThatYouLove, 'utf8');
}); });
gulp.task('bundle', ['bundle.ionic'], function() {
var concat = require('gulp-concat');
return gulp.src(buildConfig.scripts)
.pipe(concat('ionic.bundle.js'))
.pipe(gulp.dest('dist/js'));
})
gulp.task('tests', function() { gulp.task('tests', function() {
return gulp.src('ionic/**/test/**/*.spec.ts') return gulp.src('ionic/**/test/**/*.spec.ts')
.pipe(tsc(tscOptions, null, tscReporter)) .pipe(tsc(tscOptions, undefined, tscReporter))
.pipe(babel(getBabelOptions('dist/tests'))) .pipe(babel(getBabelOptions('dist/tests')))
.pipe(rename(function(file) { .pipe(rename(function(file) {
var regex = new RegExp(path.sep + 'test(' + path.sep + '|$)'); var regex = new RegExp(path.sep + 'test(' + path.sep + '|$)');
@ -281,30 +223,19 @@ gulp.task('tests', function() {
.pipe(gulp.dest('dist/tests')) .pipe(gulp.dest('dist/tests'))
}) })
gulp.task('e2e', function() { gulp.task('e2e.build', function() {
var gulpif = require('gulp-if'); var gulpif = require('gulp-if');
var lazypipe = require('lazypipe'); var merge = require('merge2');
var _ = require('lodash'); var _ = require('lodash');
var fs = require('fs'); var fs = require('fs');
var VinylFile = require('vinyl'); var VinylFile = require('vinyl');
var buildTest = lazypipe()
//.pipe(traceur, traceurOptions)
.pipe(tsc, tscOptions, null, tscReporter)
.pipe(babel, getBabelOptions('e2e'))
var buildE2ETest = lazypipe()
//.pipe(traceur, traceurOptions)
.pipe(tsc, tscOptions, null, tscReporter)
.pipe(babel)
var indexTemplate = _.template( var indexTemplate = _.template(
fs.readFileSync('scripts/e2e/e2e.template.html') fs.readFileSync('scripts/e2e/e2e.template.html')
)({ )({
buildConfig: buildConfig buildConfig: buildConfig
}) })
var testTemplate = _.template( fs.readFileSync('scripts/e2e/e2e.template.js') ) var testTemplate = _.template(fs.readFileSync('scripts/e2e/e2e.template.js'));
var platforms = [ var platforms = [
'android', 'android',
@ -312,20 +243,34 @@ gulp.task('e2e', function() {
]; ];
// Get each test folder with gulp.src // Get each test folder with gulp.src
return gulp.src(['ionic/components/*/test/*/**/*', '!ionic/components/*/test/*/**/*.spec.ts']) var tsResult = gulp.src([
.pipe(cache('e2e', { optimizeMemory: true })) 'ionic/components/*/test/*/**/*.ts',
.pipe(gulpif(/e2e.ts$/, buildE2ETest())) '!ionic/components/*/test/*/**/*.spec.ts'
.pipe(gulpif(/.ts$/, buildTest())) ])
.on('error', function (err) { .pipe(cache('e2e.ts'))
console.log("ERROR: " + err.message); .pipe(tsc(tscOptionsNoTypeCheck, undefined, tscReporter))
.on('error', function(error) {
console.log(error.message);
this.emit('end'); this.emit('end');
}) })
.pipe(gulpif(/index.js$/, createIndexHTML())) //TSC changes .ts to .js .pipe(gulpif(/index.js$/, createIndexHTML()))
.pipe(rename(function(file) {
file.dirname = file.dirname.replace(path.sep + 'test' + path.sep, path.sep)
}))
.pipe(gulpif(/e2e.js$/, createPlatformTests())) .pipe(gulpif(/e2e.js$/, createPlatformTests()))
.pipe(gulp.dest('dist/e2e/'))
var testFiles = gulp.src([
'ionic/components/*/test/*/**/*',
'!ionic/components/*/test/*/**/*.ts'
])
.pipe(cache('e2e.files'))
return merge([
tsResult,
testFiles
])
.pipe(rename(function(file) {
var sep = path.sep;
file.dirname = file.dirname.replace(sep + 'test' + sep, sep)
}))
.pipe(gulp.dest('dist/e2e/'));
function createIndexHTML() { function createIndexHTML() {
return through2.obj(function(file, enc, next) { return through2.obj(function(file, enc, next) {
@ -361,30 +306,54 @@ gulp.task('e2e', function() {
} }
}); });
gulp.task('e2e.bundle', ['e2e.build'], function(done) {
var glob = require('glob');
var webpack = require('webpack');
var path = require('path');
var _ = require('lodash');
return glob("dist/e2e/**/index.js", function(err, files){
var numTasks = files.length;
files.forEach(function(file){
var config = require('./scripts/e2e/webpack.config.js');
// add our bundle entry, removing previous if necessary
// since config is cached
if (config.entry.length > 1) {
config.entry.pop();
}
config.entry.push('./' + file);
config.output = {
libraryTarget: 'commonjs2',
filename: path.dirname(file) + '/bundle.js'
}
bundle({
config: config,
numTasks: --numTasks,
stats: false,
cb: done
});
})
})
});
gulp.task('e2e', ['e2e.bundle']);
gulp.task('sass', function() { gulp.task('sass', function() {
var sass = require('gulp-sass'); var sass = require('gulp-sass');
var autoprefixer = require('gulp-autoprefixer'); var autoprefixer = require('gulp-autoprefixer');
gulp.src('ionic/ionic.ios.scss') gulp.src([
'ionic/ionic.ios.scss',
'ionic/ionic.md.scss',
'ionic/ionic.scss'
])
.pipe(sass() .pipe(sass()
.on('error', sass.logError) .on('error', sass.logError)
) )
.pipe(autoprefixer(buildConfig.autoprefixer)) .pipe(autoprefixer(buildConfig.autoprefixer))
.pipe(gulp.dest('dist/css/')); .pipe(gulp.dest('dist/bundles/'));
gulp.src('ionic/ionic.md.scss')
.pipe(sass()
.on('error', sass.logError)
)
.pipe(autoprefixer(buildConfig.autoprefixer))
.pipe(gulp.dest('dist/css/'));
return gulp.src('ionic/ionic.scss')
.pipe(sass()
.on('error', sass.logError)
)
.pipe(autoprefixer(buildConfig.autoprefixer))
.pipe(gulp.dest('dist/css/'));
}); });
gulp.task('fonts', function() { gulp.task('fonts', function() {
@ -459,7 +428,7 @@ gulp.task('build.demos', function(){
var VinylFile = require('vinyl'); var VinylFile = require('vinyl');
var buildTest = lazypipe() var buildTest = lazypipe()
.pipe(tsc, tscOptions, null, tscReporter) .pipe(tsc, tscOptions, undefined, tscReporter)
.pipe(babel, getBabelOptions('demos', 'common')) .pipe(babel, getBabelOptions('demos', 'common'))
// .pipe(babel, getBabelOptions('demos')) // .pipe(babel, getBabelOptions('demos'))
@ -525,3 +494,45 @@ gulp.task('watch:demos', function() {
gulp.start('demos'); gulp.start('demos');
}); });
}); });
function buildDemoBundle(opts, done) {
var glob = require('glob');
var webpack = require('webpack');
var path = require('path');
var _ = require('lodash');
var fp = 'dist/demos/'+opts.demo+'/index.js';
if (opts.demo == 'api') {
fp = "dist/demos/**/index.js";
}
return glob(fp, function(err, files){
var numTasks = files.length;
files.forEach(function(file){
var config = require('./scripts/demos/webpack.config.js');
// add our bundle entry, removing previous if necessary
// since config is cached
if (config.entry.length > 4) {
config.entry.pop();
}
config.entry.push('./' + file);
config.output = {
filename: path.dirname(file) + '/bundle.js'
}
webpack(config, function(err, stats){
// var statsOptions = {
// 'colors': true,
// 'modules': true,
// 'chunks': false,
// 'exclude': ['node_modules'],
// 'errorDetails': true
// }
// console.log(stats.toString(statsOptions));
if (--numTasks === 0) done();
})
})
});
}

View File

@ -1,39 +1,38 @@
export * from './components/app/app'
export * from 'ionic/components/app/app' export * from './components/app/id'
export * from 'ionic/components/app/id' export * from './components/action-sheet/action-sheet'
export * from 'ionic/components/action-sheet/action-sheet' export * from './components/blur/blur'
export * from 'ionic/components/blur/blur' export * from './components/button/button'
export * from 'ionic/components/button/button' export * from './components/checkbox/checkbox'
export * from 'ionic/components/checkbox/checkbox' export * from './components/content/content'
export * from 'ionic/components/content/content' export * from './components/icon/icon'
export * from 'ionic/components/icon/icon' export * from './components/item/item'
export * from 'ionic/components/item/item' export * from './components/item/item-sliding'
export * from 'ionic/components/item/item-sliding' export * from './components/menu/menu'
export * from 'ionic/components/menu/menu' export * from './components/menu/menu-types'
export * from 'ionic/components/menu/menu-types' export * from './components/menu/menu-toggle'
export * from 'ionic/components/menu/menu-toggle' export * from './components/menu/menu-close'
export * from 'ionic/components/menu/menu-close' export * from './components/text-input/text-input'
export * from 'ionic/components/text-input/text-input' export * from './components/text-input/label'
export * from 'ionic/components/text-input/label' export * from './components/list/list'
export * from 'ionic/components/list/list' export * from './components/show-hide-when/show-hide-when'
export * from 'ionic/components/show-hide-when/show-hide-when' export * from './components/modal/modal'
export * from 'ionic/components/modal/modal' export * from './components/nav/nav'
export * from 'ionic/components/nav/nav' export * from './components/nav/nav-controller'
export * from 'ionic/components/nav/nav-controller' export * from './components/nav/view-controller'
export * from 'ionic/components/nav/view-controller' export * from './components/nav/nav-push'
export * from 'ionic/components/nav/nav-push' export * from './components/nav/nav-router'
export * from 'ionic/components/nav/nav-router' export * from './components/navbar/navbar'
export * from 'ionic/components/navbar/navbar' export * from './components/overlay/overlay'
export * from 'ionic/components/overlay/overlay' export * from './components/popup/popup'
export * from 'ionic/components/popup/popup' export * from './components/slides/slides'
export * from 'ionic/components/slides/slides' export * from './components/radio/radio'
export * from 'ionic/components/radio/radio' export * from './components/scroll/scroll'
export * from 'ionic/components/scroll/scroll' export * from './components/scroll/pull-to-refresh'
export * from 'ionic/components/scroll/pull-to-refresh' export * from './components/searchbar/searchbar'
export * from 'ionic/components/searchbar/searchbar' export * from './components/segment/segment'
export * from 'ionic/components/segment/segment' export * from './components/tabs/tabs'
export * from 'ionic/components/tabs/tabs' export * from './components/tabs/tab'
export * from 'ionic/components/tabs/tab' export * from './components/tap-click/tap-click'
export * from 'ionic/components/tap-click/tap-click' export * from './components/toggle/toggle'
export * from 'ionic/components/toggle/toggle' export * from './components/toolbar/toolbar'
export * from 'ionic/components/toolbar/toolbar'

View File

@ -5,7 +5,8 @@
* @description * @description
* The ActionSheet is a modal menu with options to select based on an action. * The ActionSheet is a modal menu with options to select based on an action.
*/ */
import {Component, Injectable, Renderer, NgFor, NgIf} from 'angular2/angular2'; import {Component, Injectable, Renderer} from 'angular2/core';
import {NgFor, NgIf} from 'angular2/common';
import {OverlayController} from '../overlay/overlay-controller'; import {OverlayController} from '../overlay/overlay-controller';
import {Config} from '../../config/config'; import {Config} from '../../config/config';

View File

@ -1,4 +1,5 @@
import {Injectable, NgZone, Title} from 'angular2/angular2'; import {Injectable, NgZone} from 'angular2/core';
import {Title} from 'angular2/platform/browser';
import {Config} from '../../config/config'; import {Config} from '../../config/config';
import {ClickBlock} from '../../util/click-block'; import {ClickBlock} from '../../util/click-block';

View File

@ -1,4 +1,4 @@
import {AppViewManager, ElementRef, Directive, Renderer} from 'angular2/angular2'; import {AppViewManager, ElementRef, Directive, Renderer} from 'angular2/core';
import {IonicApp} from './app'; import {IonicApp} from './app';

View File

@ -1,4 +1,5 @@
import {Component, Control, ControlGroup} from 'angular2/angular2'; import {Component} from 'angular2/core';
import {Control, ControlGroup} from 'angular2/common';
import {App, Storage, LocalStorage, SqlStorage} from 'ionic/ionic'; import {App, Storage, LocalStorage, SqlStorage} from 'ionic/ionic';

View File

@ -1,4 +1,4 @@
import {Directive, Renderer, ElementRef} from 'angular2/angular2'; import {Directive, Renderer, ElementRef} from 'angular2/core';
/** /**

View File

@ -1,4 +1,4 @@
import {Directive, ElementRef, Renderer, Attribute, Optional} from 'angular2/angular2'; import {Directive, ElementRef, Renderer, Attribute, Optional} from 'angular2/core';
import {Config} from '../../config/config'; import {Config} from '../../config/config';
import {Toolbar} from '../toolbar/toolbar'; import {Toolbar} from '../toolbar/toolbar';

View File

@ -1,4 +1,5 @@
import {Component, Directive, Optional, NgControl, ElementRef} from 'angular2/angular2'; import {Component, Directive, Optional, ElementRef} from 'angular2/core';
import {NgControl} from 'angular2/common';
import {Ion} from '../ion'; import {Ion} from '../ion';
import {Form} from '../../util/form'; import {Form} from '../../util/form';

View File

@ -9,7 +9,8 @@ import {
NgControlName, NgControlName,
NgFormModel, NgFormModel,
FormBuilder FormBuilder
} from 'angular2/angular2'; } from 'angular2/common';
@App({ @App({
templateUrl: 'main.html' templateUrl: 'main.html'

View File

@ -1,4 +1,4 @@
import {Component, ElementRef, Optional, NgZone} from 'angular2/angular2'; import {Component, ElementRef, Optional, NgZone} from 'angular2/core';
import {Ion} from '../ion'; import {Ion} from '../ion';
import {Config} from '../../config/config'; import {Config} from '../../config/config';

View File

@ -1,4 +1,4 @@
import {Directive, ElementRef, Attribute, Renderer} from 'angular2/angular2'; import {Directive, ElementRef, Attribute, Renderer} from 'angular2/core';
import {Config} from '../../config/config'; import {Config} from '../../config/config';

View File

@ -1,6 +1,7 @@
import {ElementRef} from 'angular2/core';
import {Config} from '../config/config'; import {Config} from '../config/config';
import {isArray} from 'ionic/util'; import {isArray} from '../util';
import * as dom from 'ionic/util/dom'; import * as dom from '../util/dom';
/** /**

View File

@ -1,8 +1,8 @@
import {Hammer} from 'ionic/gestures/hammer'; import {Hammer} from '../../gestures/hammer';
import {DragGesture} from 'ionic/gestures/drag-gesture'; import {DragGesture} from '../../gestures/drag-gesture';
import {List} from '../list/list'; import {List} from '../list/list';
import {CSS, raf, closest} from 'ionic/util/dom'; import {CSS, raf, closest} from '../../util/dom';
export class ItemSlidingGesture extends DragGesture { export class ItemSlidingGesture extends DragGesture {

View File

@ -1,4 +1,4 @@
import {Component, ElementRef, Optional} from 'angular2/angular2'; import {Component, ElementRef, Optional} from 'angular2/core';
import {List} from '../list/list'; import {List} from '../list/list';

View File

@ -1,4 +1,4 @@
import {Component} from 'angular2/angular2'; import {Component} from 'angular2/core';
/** /**

View File

@ -1,10 +1,10 @@
import {Directive, ElementRef, NgZone} from 'angular2/angular2'; import {Directive, ElementRef, NgZone} from 'angular2/core';
import {Ion} from '../ion'; import {Ion} from '../ion';
import {Config} from '../../config/config'; import {Config} from '../../config/config';
import {ListVirtualScroll} from './virtual'; import {ListVirtualScroll} from './virtual';
import {ItemSlidingGesture} from '../item/item-sliding-gesture'; import {ItemSlidingGesture} from '../item/item-sliding-gesture';
import * as util from 'ionic/util'; import * as util from '../../util';
/** /**
* The List is a widely used interface element in almost any mobile app, and can include * The List is a widely used interface element in almost any mobile app, and can include

View File

@ -1,5 +1,5 @@
import {ProtoViewRef, ViewContainerRef} from 'angular2/angular2' import {ProtoViewRef, ViewContainerRef} from 'angular2/core'
import {Directive, Host, forwardRef} from 'angular2/angular2'; import {Directive, Host, forwardRef} from 'angular2/core';
import {App, List} from 'ionic/ionic'; import {App, List} from 'ionic/ionic';

View File

@ -1,4 +1,4 @@
import {Directive} from 'angular2/angular2'; import {Directive} from 'angular2/core';
import {IonicApp} from '../app/app'; import {IonicApp} from '../app/app';
import {Menu} from './menu'; import {Menu} from './menu';

View File

@ -1,9 +1,9 @@
import {Menu} from './menu'; import {Menu} from './menu';
import {SlideEdgeGesture} from '../../gestures/slide-edge-gesture'; import {SlideEdgeGesture} from '../../gestures/slide-edge-gesture';
import * as util from 'ionic/util'; import * as util from '../../util';
class MenuContentGesture extends SlideEdgeGesture { export class MenuContentGesture extends SlideEdgeGesture {
constructor(menu: Menu, targetEl: Element, options = {}) { constructor(menu: Menu, targetEl: Element, options = {}) {
super(targetEl, util.extend({ super(targetEl, util.extend({

View File

@ -1,4 +1,4 @@
import {Directive, ElementRef, Optional} from 'angular2/angular2'; import {Directive, ElementRef, Optional} from 'angular2/core';
import {IonicApp} from '../app/app'; import {IonicApp} from '../app/app';
import {ViewController} from '../nav/view-controller'; import {ViewController} from '../nav/view-controller';

View File

@ -1,5 +1,5 @@
import {Menu} from './menu'; import {Menu} from './menu';
import {Animation} from 'ionic/animations/animation'; import {Animation} from '../../animations/animation';
/** /**

View File

@ -1,4 +1,4 @@
import {Component, forwardRef, Directive, Host, EventEmitter, ElementRef} from 'angular2/angular2'; import {Component, forwardRef, Directive, Host, EventEmitter, ElementRef} from 'angular2/core';
import {Ion} from '../ion'; import {Ion} from '../ion';
import {IonicApp} from '../app/app'; import {IonicApp} from '../app/app';

View File

@ -1,9 +1,9 @@
import {Injectable} from 'angular2/angular2'; import {Injectable, Type} from 'angular2/core';
import {OverlayController} from '../overlay/overlay-controller'; import {OverlayController} from '../overlay/overlay-controller';
import {Config} from '../../config/config'; import {Config} from '../../config/config';
import {Animation} from '../../animations/animation'; import {Animation} from '../../animations/animation';
import {extend} from 'ionic/util'; import {extend} from '../../util';
/** /**
* The Modal is a content pane that can go over the user's current page. * The Modal is a content pane that can go over the user's current page.

View File

@ -1,5 +1,5 @@
import {ChangeDetectorRef, Compiler, ElementRef, Injector, provide, NgZone, AppViewManager, Renderer} from 'angular2/angular2'; import {ChangeDetectorRef, Compiler, ElementRef, Injector, provide, NgZone, AppViewManager, Renderer} from 'angular2/core';
import {wtfLeave, wtfCreateScope, WtfScopeFn, wtfStartTimeRange, wtfEndTimeRange} from 'angular2/angular2'; import {wtfLeave, wtfCreateScope, WtfScopeFn, wtfStartTimeRange, wtfEndTimeRange} from 'angular2/instrumentation';
import {Ion} from '../ion'; import {Ion} from '../ion';
import {IonicApp} from '../app/app'; import {IonicApp} from '../app/app';

View File

@ -1,4 +1,4 @@
import {Directive, Optional} from 'angular2/angular2'; import {Directive, Optional} from 'angular2/core';
import {NavController} from './nav-controller'; import {NavController} from './nav-controller';
import {NavRegistry} from './nav-registry'; import {NavRegistry} from './nav-registry';

View File

@ -1,4 +1,4 @@
import {Directive, ElementRef, DynamicComponentLoader, Attribute} from 'angular2/angular2'; import {Directive, ElementRef, DynamicComponentLoader, Attribute} from 'angular2/core';
import { import {
RouterOutlet, RouterOutlet,
Router, Router,

View File

@ -1,4 +1,4 @@
import {ChangeDetectorRef, Component, Directive, ElementRef, Host, Optional, forwardRef, Inject, NgZone, Compiler, AppViewManager, Renderer, ViewContainerRef} from 'angular2/angular2'; import {ChangeDetectorRef, Component, Directive, ElementRef, Host, Optional, forwardRef, Inject, NgZone, Compiler, AppViewManager, Renderer, ViewContainerRef} from 'angular2/core';
import {IonicApp} from '../app/app'; import {IonicApp} from '../app/app';
import {Config} from '../../config/config'; import {Config} from '../../config/config';

View File

@ -1,4 +1,4 @@
import {SlideEdgeGesture} from 'ionic/gestures/slide-edge-gesture'; import {SlideEdgeGesture} from '../../gestures/slide-edge-gesture';
export class SwipeBackGesture extends SlideEdgeGesture { export class SwipeBackGesture extends SlideEdgeGesture {

View File

@ -1,4 +1,4 @@
import {Component} from 'angular2/angular2'; import {Component} from 'angular2/core';
import {App, NavController} from 'ionic/ionic'; import {App, NavController} from 'ionic/ionic';
import {Page, Config, IonicApp} from 'ionic/ionic'; import {Page, Config, IonicApp} from 'ionic/ionic';
import {NavParams, NavController, ViewController, IONIC_DIRECTIVES} from 'ionic/ionic'; import {NavParams, NavController, ViewController, IONIC_DIRECTIVES} from 'ionic/ionic';

View File

@ -1,4 +1,4 @@
import {Component, Directive, Optional, ElementRef, Renderer, TemplateRef, forwardRef, Inject, ViewContainerRef} from 'angular2/angular2'; import {Component, Directive, Optional, ElementRef, Renderer, TemplateRef, forwardRef, Inject, ViewContainerRef} from 'angular2/core';
import {Ion} from '../ion'; import {Ion} from '../ion';
import {Icon} from '../icon/icon'; import {Icon} from '../icon/icon';

View File

@ -1,5 +1,5 @@
import {Animation} from '../../animations/animation'; import {Animation} from '../../animations/animation';
import {extend} from 'ionic/util'; import {extend} from '../../util';
/** /**

View File

@ -1,4 +1,4 @@
import {ChangeDetectorRef, Component, ElementRef, Compiler, AppViewManager, NgZone, Renderer} from 'angular2/angular2'; import {ChangeDetectorRef, Component, ElementRef, Compiler, AppViewManager, NgZone, Renderer} from 'angular2/core';
import {IonicApp} from '../app/app'; import {IonicApp} from '../app/app';
import {Config} from '../../config/config'; import {Config} from '../../config/config';

View File

@ -1,5 +1,5 @@
import {FORM_DIRECTIVES, NgControl, NgControlGroup, import {Component, ElementRef, Injectable, Renderer} from 'angular2/core';
Component, ElementRef, Injectable, NgClass, NgIf, NgFor, Renderer} from 'angular2/angular2'; import {NgClass, NgIf, NgFor, FORM_DIRECTIVES} from 'angular2/common';
import {OverlayController} from '../overlay/overlay-controller'; import {OverlayController} from '../overlay/overlay-controller';
import {Config} from '../../config/config'; import {Config} from '../../config/config';

View File

@ -1,4 +1,5 @@
import {Component, Directive, ElementRef, Host, Optional, NgControl, Query, QueryList} from 'angular2/angular2'; import {Component, Directive, ElementRef, Host, Optional, Query, QueryList} from 'angular2/core';
import {NgControl} from 'angular2/common';
import {Config} from '../../config/config'; import {Config} from '../../config/config';
import {Ion} from '../ion'; import {Ion} from '../ion';

View File

@ -9,7 +9,7 @@ import {
NgControlName, NgControlName,
NgFormModel, NgFormModel,
FormBuilder FormBuilder
} from 'angular2/angular2'; } from 'angular2/common';
@App({ @App({

View File

@ -1,8 +1,9 @@
import {Component, NgIf, NgClass, ElementRef, EventEmitter, Host} from 'angular2/angular2' import {Component, ElementRef, EventEmitter, Host} from 'angular2/core'
import {NgIf, NgClass} from 'angular2/common';
import {Content} from '../content/content'; import {Content} from '../content/content';
import * as util from 'ionic/util'; import * as util from '../../util';
import {raf, ready, CSS} from 'ionic/util/dom'; import {raf, ready, CSS} from '../../util/dom';
/** /**

View File

@ -1,4 +1,4 @@
import {Component, ElementRef, onInit} from 'angular2/angular2'; import {Component, ElementRef, onInit} from 'angular2/core';
import {Ion} from '../ion'; import {Ion} from '../ion';
import {Config} from '../../config/config'; import {Config} from '../../config/config';
@ -6,7 +6,7 @@ import {Gesture} from '../../gestures/gesture';
import {CSS} from '../../util/dom'; import {CSS} from '../../util/dom';
import {Animation} from '../../animations/animation'; import {Animation} from '../../animations/animation';
import * as util from 'ionic/util'; import * as util from '../../util';
/** /**
* @name Scroll * @name Scroll

View File

@ -1,4 +1,5 @@
import {ElementRef, Pipe, NgControl, Renderer, FORM_DIRECTIVES, NgIf, NgClass, Directive, Host, forwardRef, ViewChild} from 'angular2/angular2'; import {ElementRef, Renderer, Directive, Host, forwardRef, ViewChild} from 'angular2/core';
import {NgIf, NgClass, NgControl, FORM_DIRECTIVES} from 'angular2/common';
import {Ion} from '../ion'; import {Ion} from '../ion';
import {Config} from '../../config/config'; import {Config} from '../../config/config';

View File

@ -1,4 +1,4 @@
import {NgControl, FORM_DIRECTIVES, FormBuilder, Validators, Control, ControlGroup} from 'angular2/angular2'; import {NgControl, FORM_DIRECTIVES, FormBuilder, Validators, Control, ControlGroup} from 'angular2/common';
import {App} from 'ionic/ionic'; import {App} from 'ionic/ionic';
import {SearchPipe} from 'ionic/components/searchbar/searchbar'; import {SearchPipe} from 'ionic/components/searchbar/searchbar';

View File

@ -1,4 +1,4 @@
import {FORM_DIRECTIVES, FormBuilder, Validators, Control, ControlGroup} from 'angular2/angular2'; import {FORM_DIRECTIVES, FormBuilder, Validators, Control, ControlGroup} from 'angular2/common';
import {App} from 'ionic/ionic'; import {App} from 'ionic/ionic';
import {SearchPipe} from 'ionic/components/searchbar/searchbar'; import {SearchPipe} from 'ionic/components/searchbar/searchbar';

View File

@ -1,4 +1,4 @@
import {NgControl, FORM_DIRECTIVES, FormBuilder, Validators, Control, ControlGroup} from 'angular2/angular2'; import {NgControl, FORM_DIRECTIVES, FormBuilder, Validators, Control, ControlGroup} from 'angular2/common';
import {App} from 'ionic/ionic'; import {App} from 'ionic/ionic';
import {SearchPipe} from 'ionic/components/searchbar/searchbar'; import {SearchPipe} from 'ionic/components/searchbar/searchbar';

View File

@ -1,4 +1,5 @@
import {Directive, Renderer, ElementRef, Host, Optional, NgControl} from 'angular2/angular2'; import {Directive, Renderer, ElementRef, Host, Optional} from 'angular2/core';
import {NgControl} from 'angular2/common';
import {Ion} from '../ion'; import {Ion} from '../ion';
import {Config} from '../../config/config'; import {Config} from '../../config/config';

View File

@ -1,4 +1,4 @@
import {FORM_DIRECTIVES, FormBuilder, Validators, Control, ControlGroup} from 'angular2/angular2'; import {FORM_DIRECTIVES, FormBuilder, Validators, Control, ControlGroup} from 'angular2/common';
import {App} from 'ionic/ionic'; import {App} from 'ionic/ionic';

View File

@ -1,4 +1,4 @@
import {FORM_DIRECTIVES, FormBuilder, Validators, Control, ControlGroup} from 'angular2/angular2'; import {FORM_DIRECTIVES, FormBuilder, Validators, Control, ControlGroup} from 'angular2/common';
import {App, Page} from 'ionic/ionic'; import {App, Page} from 'ionic/ionic';

View File

@ -1,9 +1,9 @@
import {Directive, Attribute, NgZone} from 'angular2/angular2' import {Directive, Attribute, NgZone} from 'angular2/core'
import {Platform} from '../../platform/platform'; import {Platform} from '../../platform/platform';
class DisplayWhen { export class DisplayWhen {
constructor(conditions, platform, ngZone) { constructor(conditions, platform, ngZone) {
this.isMatch = false; this.isMatch = false;

View File

@ -9,7 +9,7 @@ import {
NgControlName, NgControlName,
NgFormModel, NgFormModel,
FormBuilder FormBuilder
} from 'angular2/angular2'; } from 'angular2/common';
@App({ @App({
templateUrl: 'main.html' templateUrl: 'main.html'

View File

@ -1,13 +1,14 @@
import {Directive, Component, ElementRef, Host, NgClass, EventEmitter} from 'angular2/angular2'; import {Directive, Component, ElementRef, Host, EventEmitter} from 'angular2/core';
import {NgClass} from 'angular2/common';
import {Ion} from '../ion'; import {Ion} from '../ion';
import {Animation} from 'ionic/animations/animation'; import {Animation} from '../../animations/animation';
import {Gesture} from 'ionic/gestures/gesture'; import {Gesture} from '../../gestures/gesture';
import {DragGesture} from 'ionic/gestures/drag-gesture'; import {DragGesture} from '../../gestures/drag-gesture';
import {Config} from '../../config/config'; import {Config} from '../../config/config';
import {dom} from 'ionic/util'; import {dom} from '../../util';
import {CSS} from '../../util/dom'; import {CSS} from '../../util/dom';
import * as util from 'ionic/util'; import * as util from '../../util';
import {Swiper} from './swiper-widget'; import {Swiper} from './swiper-widget';
import {Scroll} from '../scroll/scroll'; import {Scroll} from '../scroll/scroll';

View File

@ -1,5 +1,4 @@
import {App} from 'ionic/ionic'; import {App} from 'ionic/ionic';
import {NgIf} from 'angular/angular';
@App({ @App({
templateUrl: 'main.html', templateUrl: 'main.html',

View File

@ -1,4 +1,4 @@
import {ChangeDetectorRef, Component, Directive, Host, ElementRef, Compiler, AppViewManager, NgZone, Renderer} from 'angular2/angular2'; import {ChangeDetectorRef, Component, Directive, Host, ElementRef, Compiler, AppViewManager, NgZone, Renderer} from 'angular2/core';
import {IonicApp} from '../app/app'; import {IonicApp} from '../app/app';
import {Config} from '../../config/config'; import {Config} from '../../config/config';

View File

@ -1,4 +1,5 @@
import {Directive, ElementRef, Optional, Host, NgFor, NgIf, forwardRef, ViewContainerRef} from 'angular2/angular2'; import {Directive, ElementRef, Optional, Host, forwardRef, ViewContainerRef} from 'angular2/core';
import {NgFor, NgIf} from 'angular2/common';
import {Ion} from '../ion'; import {Ion} from '../ion';
import {Attr} from '../app/id'; import {Attr} from '../app/id';

View File

@ -1,6 +1,6 @@
import {App, Page, NavController, Tab} from 'ionic/ionic'; import {App, Page, NavController, Tab} from 'ionic/ionic';
import {ContentChild, QueryList, ViewChildren} from 'angular2/angular2'; import {ContentChild, QueryList, ViewChildren} from 'angular2/core';
// //
// Tab 1 // Tab 1

View File

@ -1,4 +1,4 @@
import {Injectable, NgZone} from 'angular2/angular2'; import {Injectable, NgZone} from 'angular2/core';
import {IonicApp} from '../app/app'; import {IonicApp} from '../app/app';
import {Config} from '../../config/config'; import {Config} from '../../config/config';

View File

@ -1,4 +1,4 @@
import {Directive, Optional, ElementRef, Renderer} from 'angular2/angular2'; import {Directive, Optional, ElementRef, Renderer} from 'angular2/core';
import {Config} from '../../config/config'; import {Config} from '../../config/config';
import {TextInput} from './text-input'; import {TextInput} from './text-input';

View File

@ -1,5 +1,5 @@
import {App} from 'ionic/ionic'; import {App} from 'ionic/ionic';
import {FormBuilder, Validators} from 'angular2/angular2'; import {FormBuilder, Validators} from 'angular2/common';
@App({ @App({

View File

@ -7,7 +7,6 @@ import {App} from 'ionic/ionic';
class E2EApp { class E2EApp {
submit(ev) { submit(ev) {
debugger
} }
} }

View File

@ -1,4 +1,5 @@
import {Component, Directive, Attribute, NgIf, forwardRef, Host, Optional, ElementRef, Renderer, Attribute, NgControl} from 'angular2/angular2'; import {Component, Directive, Attribute, forwardRef, Host, Optional, ElementRef, Renderer} from 'angular2/core';
import {NgIf, NgControl} from 'angular2/common';
import {NavController} from '../nav/nav-controller'; import {NavController} from '../nav/nav-controller';
import {Config} from '../../config/config'; import {Config} from '../../config/config';

View File

@ -9,7 +9,7 @@ import {
NgControlName, NgControlName,
NgFormModel, NgFormModel,
FormBuilder FormBuilder
} from 'angular2/angular2'; } from 'angular2/common';
@App({ @App({
templateUrl: 'main.html' templateUrl: 'main.html'

View File

@ -1,4 +1,5 @@
import {Component, Directive, ElementRef, Host, Optional, NgControl, Inject, forwardRef} from 'angular2/angular2'; import {Component, Directive, ElementRef, Host, Optional, Inject, forwardRef} from 'angular2/core';
import {NgControl} from 'angular2/common';
import {Form} from '../../util/form'; import {Form} from '../../util/form';
import {Config} from '../../config/config'; import {Config} from '../../config/config';

View File

@ -1,4 +1,4 @@
import {Component, Directive, Host, ElementRef, Optional, forwardRef, Inject, ContentChildren, ContentChild, QueryList} from 'angular2/angular2'; import {Component, Directive, Host, ElementRef, Optional, forwardRef, Inject, ContentChildren, ContentChild, QueryList} from 'angular2/core';
import {Ion} from '../ion'; import {Ion} from '../ion';
import {Config} from '../../config/config'; import {Config} from '../../config/config';

View File

@ -1,4 +1,4 @@
import {bootstrap, provide} from 'angular2/angular2'; import {provide, Provider} from 'angular2/core';
import {ROUTER_PROVIDERS, LocationStrategy, HashLocationStrategy} from 'angular2/router'; import {ROUTER_PROVIDERS, LocationStrategy, HashLocationStrategy} from 'angular2/router';
import {HTTP_PROVIDERS} from 'angular2/http'; import {HTTP_PROVIDERS} from 'angular2/http';

View File

@ -1,155 +1,3 @@
import {Component, bootstrap} from 'angular2/angular2' export * from './decorators/config-component'
export * from './decorators/app'
import {TapClick} from '../components/tap-click/tap-click'; export * from './decorators/page'
import {pascalCaseToDashCase} from '../util/util';
import {ionicProviders} from './bootstrap';
import {IONIC_DIRECTIVES} from './directives';
/**
* _For more information on how pages are created, see the [NavController API
* reference](../../components/nav/NavController/#creating_pages)._
*
* 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](../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:
*
* ```ts
* @Page({
* template: `
* <ion-checkbox my-custom-dir>
* </ion-checkbox>`
* directives: [MyCustomDirective]
* })
* class MyPage {}
* ```
* Here [Checkbox](../../../components/checkbox/Checkbox/) will load because
* it is in IONIC_DIRECTIVES, so there is no need to add it to the `directives`
* array.
*
* For custom components that use Ionic components, you will need to include
* IONIC_DIRECTIVES in the `directives` array:
*
* ```ts
* import {IONIC_DIRECTIVES} from 'ionic/ionic';
* @Component({
* selector: 'my-component'
* template: `<div class="my-style">
* <ion-checkbox></ion-checkbox>
* </div>`,
* directives: [IONIC_DIRECTIVES]
* })
* class MyCustomCheckbox {}
*```
* Alternatively, you could:
* ```ts
* import {Checkbox, Icon} from 'ionic/ionic'
* ```
* 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 `<ion-view>`, so although
* you may see these tags if you inspect your markup, you don't need to include
* them in your templates.
*/
export 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;
}
}
/**
* @private
*/
export function ConfigComponent(config) {
return function(cls) {
var annotations = Reflect.getMetadata('annotations', cls) || [];
annotations.push(new Component(appendConfig(cls, config)));
Reflect.defineMetadata('annotations', annotations, cls);
return cls;
}
}
/**
* @private
*/
function appendConfig(cls, config) {
config.host = config.host || {};
cls.defaultInputs = config.defaultInputs || {};
config.inputs = config.inputs || [];
for (let prop in cls.defaultInputs) {
// add the property to the component "inputs"
config.inputs.push(prop);
// set the component "hostProperties", so the instance's
// input value will be used to set the element's attribute
config.host['[attr.' + pascalCaseToDashCase(prop) + ']'] = prop;
}
cls.delegates = config.delegates;
return config;
}
/**
* @ngdoc service
* @name App
* @module ionic
* @param {object} [config] - the app's [../Config](Config) object
* @param {string} [template] - the template to use for the app root
* @param {string} [templateUrl] - a relative URL pointing to the template to use for the app root
* @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.
*/
export function App(args={}) {
return function(cls) {
// get current annotations
let 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 <ion-nav>
if (!args.templateUrl && !args.template) {
args.template = '<ion-nav></ion-nav>';
}
// create @Component
annotations.push(new Component(args));
// redefine with added annotations
Reflect.defineMetadata('annotations', annotations, cls);
bootstrap(cls, ionicProviders(args)).then(appRef => {
appRef.injector.get(TapClick);
});
return cls;
}
}

View File

@ -0,0 +1,45 @@
import {Component} from 'angular2/core';
import {bootstrap} from 'angular2/platform/browser';
import {TapClick} from '../../components/tap-click/tap-click';
import {ionicProviders} from '../bootstrap';
import {IONIC_DIRECTIVES} from '../directives';
/**
* @ngdoc service
* @name App
* @module ionic
* @param {object} [config] - the app's [../Config](Config) object
* @param {string} [template] - the template to use for the app root
* @param {string} [templateUrl] - a relative URL pointing to the template to use for the app root
* @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.
*/
export function App(args={}) {
return function(cls) {
// get current annotations
let 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 <ion-nav>
if (!args.templateUrl && !args.template) {
args.template = '<ion-nav></ion-nav>';
}
// create @Component
annotations.push(new Component(args));
// redefine with added annotations
Reflect.defineMetadata('annotations', annotations, cls);
bootstrap(cls, ionicProviders(args)).then(appRef => {
appRef.injector.get(TapClick);
});
return cls;
}
}

View File

@ -0,0 +1,39 @@
import {Component} from 'angular2/core'
import {pascalCaseToDashCase} from '../../util/util';
/**
* @private
*/
export function ConfigComponent(config) {
return function(cls) {
var annotations = Reflect.getMetadata('annotations', cls) || [];
annotations.push(new Component(appendConfig(cls, config)));
Reflect.defineMetadata('annotations', annotations, cls);
return cls;
}
}
/**
* @private
*/
function appendConfig(cls, config) {
config.host = config.host || {};
cls.defaultInputs = config.defaultInputs || {};
config.inputs = config.inputs || [];
for (let prop in cls.defaultInputs) {
// add the property to the component "inputs"
config.inputs.push(prop);
// set the component "hostProperties", so the instance's
// input value will be used to set the element's attribute
config.host['[attr.' + pascalCaseToDashCase(prop) + ']'] = prop;
}
cls.delegates = config.delegates;
return config;
}

View File

@ -0,0 +1,75 @@
import {Component} from 'angular2/core'
import {IONIC_DIRECTIVES} from '../directives';
/**
* _For more information on how pages are created, see the [NavController API
* reference](../../components/nav/NavController/#creating_pages)._
*
* 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](../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:
*
* ```ts
* @Page({
* template: `
* <ion-checkbox my-custom-dir>
* </ion-checkbox>`
* directives: [MyCustomDirective]
* })
* class MyPage {}
* ```
* Here [Checkbox](../../../components/checkbox/Checkbox/) will load because
* it is in IONIC_DIRECTIVES, so there is no need to add it to the `directives`
* array.
*
* For custom components that use Ionic components, you will need to include
* IONIC_DIRECTIVES in the `directives` array:
*
* ```ts
* import {IONIC_DIRECTIVES} from 'ionic/ionic';
* @Component({
* selector: 'my-component'
* template: `<div class="my-style">
* <ion-checkbox></ion-checkbox>
* </div>`,
* directives: [IONIC_DIRECTIVES]
* })
* class MyCustomCheckbox {}
*```
* Alternatively, you could:
* ```ts
* import {Checkbox, Icon} from 'ionic/ionic'
* ```
* 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 `<ion-view>`, so although
* you may see these tags if you inspect your markup, you don't need to include
* them in your templates.
*/
export 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;
}
}

View File

@ -1,4 +1,5 @@
import {CORE_DIRECTIVES, FORM_DIRECTIVES, forwardRef} from 'angular2/angular2' import {forwardRef, Type} from 'angular2/core';
import {CORE_DIRECTIVES, FORM_DIRECTIVES} from 'angular2/common';
import {OverlayNav} from '../components/overlay/overlay'; import {OverlayNav} from '../components/overlay/overlay';
import {Menu} from '../components/menu/menu'; import {Menu} from '../components/menu/menu';

View File

@ -1,5 +1,5 @@
import {Gesture} from 'ionic/gestures/gesture'; import {Gesture} from './gesture';
import * as util from 'ionic/util'; import * as util from '../util';
export class DragGesture extends Gesture { export class DragGesture extends Gesture {

View File

@ -1,5 +1,5 @@
import * as util from 'ionic/util'; import * as util from '../util';
import {Hammer} from 'ionic/gestures/hammer'; import {Hammer} from './hammer';
/** /**
* A gesture recognizer class. * A gesture recognizer class.

View File

@ -1,4 +1,4 @@
import {SlideGesture} from 'ionic/gestures/slide-gesture'; import {SlideGesture} from './slide-gesture';
import {defaults} from '../util/util'; import {defaults} from '../util/util';
import {windowDimensions} from '../util/dom'; import {windowDimensions} from '../util/dom';

View File

@ -1,5 +1,5 @@
import {DragGesture} from 'ionic/gestures/drag-gesture'; import {DragGesture} from './drag-gesture';
import * as util from 'ionic/util'; import * as util from '../util';
export class SlideGesture extends DragGesture { export class SlideGesture extends DragGesture {
constructor(element, opts = {}) { constructor(element, opts = {}) {

View File

@ -1,14 +1,12 @@
export * from './config/bootstrap' export * from './config/bootstrap'
export * from './config/config' export * from './config/config'
export * from './config/modes'
export * from './config/decorators' export * from './config/decorators'
export * from './config/directives' export * from './config/directives'
export * from './components' export * from './components'
export * from './platform/platform' export * from './platform/platform'
export * from './platform/registry'
export * from './platform/storage' export * from './platform/storage'
export * from './util/click-block' export * from './util/click-block'
@ -16,9 +14,15 @@ export * from './util/events'
export * from './util/keyboard' export * from './util/keyboard'
export * from './animations/animation' export * from './animations/animation'
export * from './animations/builtins'
export * from './animations/ios-transition'
export * from './animations/md-transition'
export * from './translation/translate' export * from './translation/translate'
export * from './translation/translate_pipe' export * from './translation/translate_pipe'
// these modules don't export anything
import './config/modes'
import './platform/registry'
import './animations/builtins'
import './animations/ios-transition'
import './animations/md-transition'

View File

@ -1,6 +1,6 @@
import {StorageEngine} from './storage'; import {StorageEngine} from './storage';
import * as util from 'ionic/util'; import * as util from '../../util';
const DB_NAME = '__ionicstorage'; const DB_NAME = '__ionicstorage';

View File

@ -1,4 +1,4 @@
import {Injectable} from 'angular2/angular2'; import {Injectable} from 'angular2/core';
/** /**
* @private * @private

View File

@ -1,4 +1,4 @@
import {Injectable, Pipe, PipeTransform} from 'angular2/angular2'; import {Injectable, Pipe, PipeTransform} from 'angular2/core';
import {Translate} from './translate'; import {Translate} from './translate';

View File

@ -1,4 +1,4 @@
import * as domUtil from 'ionic/util/dom' import * as domUtil from './util/dom'
export const dom = domUtil export const dom = domUtil
export * from 'ionic/util/util' export * from './util/util'

View File

@ -1,4 +1,4 @@
import {Injectable} from 'angular2/angular2'; import {Injectable} from 'angular2/core';
/** /**
* Events is a pub/sub style event system for sending and responding to application-level * Events is a pub/sub style event system for sending and responding to application-level

View File

@ -1,4 +1,4 @@
import {Injectable} from 'angular2/angular2'; import {Injectable} from 'angular2/core';
/** /**

View File

@ -1,4 +1,4 @@
import {Injectable, NgZone} from 'angular2/angular2'; import {Injectable, NgZone} from 'angular2/core';
import {Config} from '../config/config'; import {Config} from '../config/config';
import {Form} from './form'; import {Form} from './form';

View File

@ -52,7 +52,7 @@
"gulp-rename": "~1.2.0", "gulp-rename": "~1.2.0",
"gulp-sass": "^2.0.4", "gulp-sass": "^2.0.4",
"gulp-shell": "^0.4.0", "gulp-shell": "^0.4.0",
"gulp-typescript": "^2.7.7", "gulp-typescript": "^2.9.2",
"gulp-util": "^3.0.6", "gulp-util": "^3.0.6",
"gulp-watch": "^4.2.4", "gulp-watch": "^4.2.4",
"html-entities": "^1.1.3", "html-entities": "^1.1.3",
@ -64,6 +64,7 @@
"karma-jasmine": "^0.3.5", "karma-jasmine": "^0.3.5",
"lazypipe": "^0.2.3", "lazypipe": "^0.2.3",
"lunr": "^0.5.12", "lunr": "^0.5.12",
"merge2": "^0.3.6",
"minimist": "^1.1.3", "minimist": "^1.1.3",
"mkdirp": "^0.5.1", "mkdirp": "^0.5.1",
"node-html-encoder": "0.0.2", "node-html-encoder": "0.0.2",
@ -73,9 +74,9 @@
"semver": "^5.0.1", "semver": "^5.0.1",
"serve-static": "^1.9.2", "serve-static": "^1.9.2",
"source-map-support": "^0.2.10", "source-map-support": "^0.2.10",
"systemjs": "0.18.10", "systemjs": "0.19.6",
"through2": "^0.6.3", "through2": "^0.6.3",
"typescript": "1.6.2", "typescript": "^1.7.3",
"vinyl": "^0.4.6", "vinyl": "^0.4.6",
"webpack": "^1.12.2", "webpack": "^1.12.2",
"yargs": "^3.6.0" "yargs": "^3.6.0"

View File

@ -17,6 +17,7 @@ module.exports = {
'node_modules/angular2/bundles/angular2.dev.js', 'node_modules/angular2/bundles/angular2.dev.js',
'node_modules/angular2/bundles/router.dev.js', 'node_modules/angular2/bundles/router.dev.js',
'node_modules/angular2/bundles/http.dev.js', 'node_modules/angular2/bundles/http.dev.js',
'node_modules/es6-shim/es6-shim.min.js',
'dist/js/ionic.js', 'dist/js/ionic.js',
'scripts/resources/web-animations-js/web-animations.min.js' 'scripts/resources/web-animations-js/web-animations.min.js'
], ],

View File

@ -5,8 +5,12 @@
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" /> <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<link ios-href="../../../css/ionic.ios.css" rel="stylesheet"> <link ios-href="/dist/bundles/ionic.ios.css" rel="stylesheet">
<link md-href="../../../css/ionic.md.css" rel="stylesheet"> <link md-href="/dist/bundles/ionic.md.css" rel="stylesheet">
<script src="/node_modules/systemjs/node_modules/es6-module-loader/dist/es6-module-loader.src.js"></script>
<script src="/node_modules/systemjs/dist/system.src.js"></script>
<script src="/node_modules/angular2/bundles/angular2-polyfills.js"></script>
<script> <script>
if (!console.time) { if (!console.time) {
@ -78,19 +82,15 @@
<ion-loading-icon></ion-loading-icon> <ion-loading-icon></ion-loading-icon>
</ion-app> </ion-app>
<script src="../../../js/ionic.bundle.js"></script>
<script> <script>
System.config({ System.config({
"paths": { map: {
"*": "*.js", 'rxjs': '/node_modules/rxjs',
"ionic/*": "ionic/*", 'angular2': '/node_modules/angular2/bundles/angular2.umd.dev.js',
"angular2/*": "angular2/*", 'ionic/ionic': '/dist/bundles/ionic.js'
"rxjs/*": "rxjs/*"
} }
}) })
System.import("index").then(function(m) {}, console.error.bind(console)); System.import('bundle.js').then(function(m) {}, console.error.bind(console));
console.timeEnd('script init'); console.timeEnd('script init');
</script> </script>

View File

@ -0,0 +1,37 @@
module.exports = {
entry: [
"web-animations.min"
],
externals: [
{
'ionic/ionic': {
commonjs2: 'ionic/ionic'
},
'angular2/core': {
commonjs2: ['angular2', 'core']
},
'angular2/common': {
commonjs2: ['angular2', 'common']
},
'angular2/router' : {
commonjs2: ['angular2', 'router']
},
'angular2/http': {
commonjs2: ['angular2', 'http']
},
'angular2/platform/browser': {
commonjs2: ['angular2', 'platform', 'browser']
},
'angular2/instrumentation': {
commonjs2: ['angular2', 'instrumentation']
},
}
],
module: {
loaders: [{ test: /\.ts$/, loader: "awesome-typescript-loader" }]
},
resolve: {
alias: {'web-animations.min': './dist/js/web-animations.min'},
extensions: ["", ".js", ".ts"]
}
};

View File

@ -0,0 +1,32 @@
module.exports = {
entry: [
"./dist/ionic.js"
],
output: {
path: 'dist/bundles',
filename: 'ionic.js',
libraryTarget: 'commonjs2'
},
externals: [
{
'angular2/core': {
commonjs2: ['angular2', 'core']
},
'angular2/common': {
commonjs2: ['angular2', 'common']
},
'angular2/router' : {
commonjs2: ['angular2', 'router']
},
'angular2/http': {
commonjs2: ['angular2', 'http']
},
'angular2/platform/browser': {
commonjs2: ['angular2', 'platform', 'browser']
},
'angular2/instrumentation': {
commonjs2: ['angular2', 'instrumentation']
},
}
]
};

View File

@ -1,23 +1,18 @@
{ {
"version": "1.5.0",
"compilerOptions": { "compilerOptions": {
"emitDecoratorMetadata": true, "emitDecoratorMetadata": true,
"experimentalDecorators": true, "experimentalDecorators": true,
"target": "es6", "target": "es5",
"module": "system", "module": "commonjs",
"declaration": true "declaration": true,
"outDir": "dist"
}, },
"fileGlobs": [ "files": [
"./ionic/**/*.ts", "ionic/ionic.ts"
"!./node_modules/**",
"!./scripts/**",
"!./dist/**",
"!./tmp/**"
], ],
"compileOnSave" : false, "compileOnSave" : false,
"buildOnSave": false, "buildOnSave": false,
"exclude": [ "exclude": [
"node_modules", "node_modules"
"ionic"
] ]
} }