diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000..da592f8d92 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +node_modules +.DS_Store +dist diff --git a/gulpfile.js b/gulpfile.js new file mode 100644 index 0000000000..f357b002b5 --- /dev/null +++ b/gulpfile.js @@ -0,0 +1,114 @@ +///// +// Mostly stolen from https://github.com/pkozlowski-opensource/ng2-play +///// + +var gulp = require('gulp'); +var gulpif = require('gulp-if'); +var del = require('del'); +var concat = require('gulp-concat'); +var plumber = require('gulp-plumber'); +var rename = require('gulp-rename'); +var traceur = require('gulp-traceur'); +var lazypipe = require('lazypipe'); + +var config = { + dist: 'dist', + src: { + js: 'src/**/*.js', + html: 'src/**/*.html', + playgroundJs: 'playground/**/*.js', + playgroundFiles: ['playground/**/*', '!playground/**/*.js'], + }, + lib: [ + 'node_modules/gulp-traceur/node_modules/traceur/bin/traceur-runtime.js', + 'node_modules/es6-module-loader/dist/es6-module-loader-sans-promises.src.js', + 'node_modules/systemjs/lib/extension-register.js', + 'node_modules/angular2/node_modules/zone.js/zone.js', + ] +}; + +gulp.task('default', ['js', 'html', 'libs', 'playgroundJs', 'playgroundFiles']); + +gulp.task('watch', ['default'], function () { + var http = require('http'); + var connect = require('connect'); + var serveStatic = require('serve-static'); + var open = require('open'); + var port = 9000; + + gulp.watch(config.src.html, ['html']); + gulp.watch(config.src.js, ['js']); + gulp.watch(config.src.playgroundJs, ['playgroundJs']); + gulp.watch(config.src.playgroundFiles, ['playgroundFiles']); + + var app = connect().use(serveStatic(__dirname + '/' + config.dist)); // serve everything that is static + http.createServer(app).listen(port); + console.log('Serving `dist` on http://localhost:' + port); +}); + +gulp.task('clean', function(done) { + del([config.dist], done); +}); + +gulp.task('playgroundFiles', function() { + return gulp.src(config.src.playgroundFiles) + .pipe(gulp.dest(config.dist)); +}); + +gulp.task('playgroundJs', function() { + return gulp.src(config.src.playgroundJs) + .pipe(traceurCompile()) + .pipe(gulp.dest(config.dist)); +}); + +function traceurCompile() { + return lazypipe() + .pipe(rename, {extname: ''}) //hack, see: https://github.com/sindresorhus/gulp-traceur/issues/54 + .pipe(plumber) + .pipe(traceur, { + modules: 'instantiate', + moduleName: true, + annotations: true, + types: true + }) + .pipe(rename, {extname: '.js'}) //hack, see: https://github.com/sindresorhus/gulp-traceur/issues/54 + (); +} +gulp.task('js', function () { + return gulp.src(config.src.js) + .pipe(rename(function(file) { + // Forces the files to register themselves with 'ionic' prefix + file.dirname = 'ionic/' + file.dirname; + })) + .pipe(traceurCompile()) + // compiled js files in playground go to the playground root, everything else goes in /ionic + .pipe(gulp.dest('dist')); +}); + +gulp.task('html', function () { + // Don't do anything with html for now + // return gulp.src(config.src.html) + // .pipe(gulp.dest(config.dist)); +}); + +gulp.task('libs', ['angular2'], function () { + return gulp.src(config.lib) + .pipe(gulp.dest('dist/lib')); +}); + +gulp.task('angular2', function () { + //transpile & concat + return gulp.src([ + 'node_modules/angular2/es6/prod/*.es6', + 'node_modules/angular2/es6/prod/src/**/*.es6' + ], { + base: 'node_modules/angular2/es6/prod' + }) + .pipe(rename(function(path){ + path.dirname = 'angular2/' + path.dirname; //this is not ideal... but not sure how to change angular's file structure + path.extname = ''; //hack, see: https://github.com/sindresorhus/gulp-traceur/issues/54 + })) + .pipe(traceur({ modules: 'instantiate', moduleName: true})) + .pipe(concat('angular2.js')) + .pipe(gulp.dest('dist/lib')); +}); diff --git a/package.json b/package.json new file mode 100644 index 0000000000..96ab2e6f1c --- /dev/null +++ b/package.json @@ -0,0 +1,24 @@ +{ + "name": "ionic2", + "version": "0.0.0", + "devDependencies": { + "connect": "^3.3.4", + "del": "~1.1.1", + "gulp": "~3.8.10", + "gulp-concat": "~2.5.0", + "gulp-if": "^1.2.5", + "gulp-plumber": "^1.0.0", + "gulp-rename": "~1.2.0", + "gulp-traceur": "0.16.*", + "lazypipe": "^0.2.2", + "open": "0.0.5", + "serve-static": "~1.8.1", + "through2": "~0.6.3" + }, + "dependencies": { + "angular2": "2.0.0-alpha.13", + "es6-module-loader": "~0.11.0", + "systemjs": "~0.11.0", + "zone.js": "0.4.1" + } +} diff --git a/playground/app.html b/playground/app.html new file mode 100644 index 0000000000..99f74516d2 --- /dev/null +++ b/playground/app.html @@ -0,0 +1 @@ + diff --git a/playground/index.html b/playground/index.html new file mode 100644 index 0000000000..0a6ab4ac54 --- /dev/null +++ b/playground/index.html @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + Loading... + + + + + + + diff --git a/playground/main.js b/playground/main.js new file mode 100644 index 0000000000..eaafd18dea --- /dev/null +++ b/playground/main.js @@ -0,0 +1,12 @@ +import {bootstrap} from 'angular2/core'; +import {Component, Template} from 'angular2/angular2'; +import {Tabbar} from './ionic/components/tabbar/tabbar'; + +@Component({ selector: 'playground-main' }) +@Template({ + url: 'app.html', + directives: [Tabbar] +}) +class PlaygroundMain {} + +bootstrap(PlaygroundMain); diff --git a/src/components/control/button/button.js b/src/components/control/button/button.js deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/components/control/button/button.scss b/src/components/control/button/button.scss deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/components/control/button/button.spec.js b/src/components/control/button/button.spec.js deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/components/control/button/examples/example1/example1.e2e.js b/src/components/control/button/examples/example1/example1.e2e.js deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/components/control/button/examples/example1/example1.js b/src/components/control/button/examples/example1/example1.js deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/components/control/button/examples/example1/example1.scss b/src/components/control/button/examples/example1/example1.scss deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/components/control/button/examples/example1/index.html b/src/components/control/button/examples/example1/index.html deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/components/control/control.js b/src/components/control/control.js deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/components/control/control.spec.js b/src/components/control/control.spec.js deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/components/ion.js b/src/components/ion.js index 69e72a188e..71c417e0ba 100644 --- a/src/components/ion.js +++ b/src/components/ion.js @@ -1,8 +1,20 @@ -class Ion { - assign(...args) { - for (let obj of args) { - //...extend this +var ILLEGAL_ASSIGN_FIELDS = {}; +export class Ion { + + assign() { + for (var i = 1, ii = arguments.length; i < ii; i++) { + var obj = arguments[i]; + if (obj) { + var keys = Object.keys(obj); + for (var j = 0, jj = keys.length; j < jj; j++) { + var key = keys[j]; + if (!ILLEGAL_ASSIGN_FIELDS[key]) { + this[key] = obj[key]; + } + } + } } } + } diff --git a/src/components/ion.spec.js b/src/components/ion.spec.js deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/components/tabbar/mixins/android/android-tabbar.js b/src/components/tabbar/mixins/android/android-tabbar.js index 586ae79636..6abda7512e 100644 --- a/src/components/tabbar/mixins/android/android-tabbar.js +++ b/src/components/tabbar/mixins/android/android-tabbar.js @@ -1,4 +1,4 @@ - +/* import {TabbarConfig} from '/components/tabbar/tabbar'; import {Draggable} from '/behaviors/draggable'; @@ -15,6 +15,5 @@ TabbarConfig.platform('android') }); }); -/* */ diff --git a/src/components/tabbar/tabbar.js b/src/components/tabbar/tabbar.js index b96d851524..f1e71e826b 100644 --- a/src/components/tabbar/tabbar.js +++ b/src/components/tabbar/tabbar.js @@ -1,3 +1,14 @@ +import {Component, Template} from 'angular2/angular2'; +import {Ion} from '../ion'; -class Tabbar extends Ion { +@Component({ + selector: 'tabbar', + bind: { + title: 'view-title' + } +}) +@Template({ + inline: `
Tabbar: {{title}}
` +}) +export class Tabbar extends Ion { } diff --git a/src/components/tabbar/tabbar.spec.js b/src/components/tabbar/tabbar.spec.js deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/old/button/built.js b/src/old/button/built.js deleted file mode 100644 index 3141d7f542..0000000000 --- a/src/old/button/built.js +++ /dev/null @@ -1,9 +0,0 @@ -import {ButtonConfig} from './button-config'; -import {AndroidButton} from './mixins/android/android-button'; -import {LargeButton} from './mixins/android-button'; - -ButtonConfig.platform('android').mixin(AndroidButton); - -ButtonConfig.media('lg').mixin(DesktopButton); - -ButtonConfig.when('popBehavior').mixin(PopButton); diff --git a/src/old/button/button.js b/src/old/button/button.js deleted file mode 100644 index 98bae1f26e..0000000000 --- a/src/old/button/button.js +++ /dev/null @@ -1,22 +0,0 @@ -import { Component } from 'angular'; -import { ButtonGroup } from '../components/button-group'; -import { androidButton} from './platforms/android/android-button'; -import { blockButton } from './block-button'; - -@Component({ - selector: 'ion-button', - bind: { - isBlockButton: 'isBlockButton' - } -}) -export class Button extends IonicComponent { - /* A button checks for a parent buttonGroup */ - constructor(@Parent(ButtonGroup) buttonGroup) { - this.buttonGroup = buttonGroup; - super(); - } - onPress() { - } -} -export var ButtonConfig = new IonicConfig('button'); - diff --git a/src/old/button/button.scss b/src/old/button/button.scss deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/old/button/button.spec.js b/src/old/button/button.spec.js deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/old/button/examples/inline-button/index.html b/src/old/button/examples/inline-button/index.html deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/old/button/examples/inline-button/inline-button.e2e.js b/src/old/button/examples/inline-button/inline-button.e2e.js deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/old/button/examples/inline-button/inline-button.js b/src/old/button/examples/inline-button/inline-button.js deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/old/button/examples/inline-button/style.scss b/src/old/button/examples/inline-button/style.scss deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/old/button/mixins/android/android-button.js b/src/old/button/mixins/android/android-button.js deleted file mode 100644 index a4de0fe5f2..0000000000 --- a/src/old/button/mixins/android/android-button.js +++ /dev/null @@ -1,14 +0,0 @@ -import { ButtonConfig } from '/components/button'; - -ButtonConfig.platform('android') - .mixin(androidButtonMixin) - .className('button-android'); // This is the default - -export default function androidButtonMixin(buttonInstance) { - Pannable(buttonInstance); - return { - onPanStart() {}, - onPan() {}, - onPanEnd() {} - }; -} diff --git a/src/old/button/mixins/android/android-button.scss b/src/old/button/mixins/android/android-button.scss deleted file mode 100644 index d74a9dfdf2..0000000000 --- a/src/old/button/mixins/android/android-button.scss +++ /dev/null @@ -1,3 +0,0 @@ -.button.button-android { - border-radius: 5px; -} diff --git a/src/old/button/mixins/pop/pop-button.js b/src/old/button/mixins/pop/pop-button.js deleted file mode 100644 index c2bf3cd7cd..0000000000 --- a/src/old/button/mixins/pop/pop-button.js +++ /dev/null @@ -1,25 +0,0 @@ -import { ButtonConfig } from '/components/button'; - -ButtonConfig.decorator('popButton') - .mixin(popButtonMixin) - .className('button-pop'); - -function popButtonMixin(buttonInstance) { - return { - onRelease() { - alert('pop!'); - } - }; -} - -/* -//instance config -