Skip to content

Commit 78fe236

Browse files
committed
Initial commit
0 parents  commit 78fe236

28 files changed

+400
-0
lines changed

.editorconfig

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# EditorConfig is awesome: http://EditorConfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
# Unix-style newlines with a newline ending every file
7+
[*]
8+
end_of_line = lf
9+
insert_final_newline = true
10+
11+
# 2 space indentation
12+
[**.*]
13+
indent_style = space
14+
indent_size = 2

.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
de_modules
3+
jspm_packages
4+
bower_components
5+
.idea
6+
.DS_STORE

CONTRIBUTING.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Contributing
2+
3+
We'd love for you to contribute and to make this project even better than it is today! If this interests you, please begin by reading [our contributing guidelines](https://github.com/DurandalProject/about/blob/master/CONTRIBUTING.md). The contributing document will provide you with all the information you need to get started. Once you have read that, you will need to also [sign our CLA](http://goo.gl/forms/dI8QDDSyKR) before we can accept a Pull Request from you. More information on the process is included in the [contributor's guide](https://github.com/DurandalProject/about/blob/master/CONTRIBUTING.md).

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2014 Durandal Inc.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Whitespace-only changes.

build/args.js

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
var yargs = require('yargs');
2+
3+
var argv = yargs.argv,
4+
validBumpTypes = "major|minor|patch|prerelease".split("|"),
5+
bump = (argv.bump || 'patch').toLowerCase();
6+
7+
if(validBumpTypes.indexOf(bump) === -1) {
8+
throw new Error('Unrecognized bump "' + bump + '".');
9+
}
10+
11+
module.exports = {
12+
bump: bump
13+
};

build/babel-options.js

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
module.exports = {
2+
filename: '',
3+
filenameRelative: '',
4+
blacklist: [],
5+
whitelist: [],
6+
modules: '',
7+
sourceMap: true,
8+
sourceMapName: '',
9+
sourceRoot: '',
10+
moduleRoot: '',
11+
moduleIds: false,
12+
experimental: false,
13+
format: {
14+
comments: false,
15+
compact: false,
16+
indent: {
17+
parentheses: true,
18+
adjustMultilineComment: true,
19+
style: " ",
20+
base: 0
21+
}
22+
}
23+
};

build/paths.js

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
var path = require('path');
2+
3+
var appRoot = 'src/';
4+
5+
module.exports = {
6+
root: appRoot,
7+
source: appRoot + '**/*.js',
8+
html: appRoot + '**/*.html',
9+
style: 'styles/**/*.css',
10+
output: 'dist/',
11+
doc:'./doc',
12+
e2eSpecsSrc: 'test/e2e/src/*.js',
13+
e2eSpecsDist: 'test/e2e/dist/'
14+
};

build/tasks/build.js

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
var gulp = require('gulp');
2+
var runSequence = require('run-sequence');
3+
var to5 = require('gulp-babel');
4+
var paths = require('../paths');
5+
var compilerOptions = require('../babel-options');
6+
var assign = Object.assign || require('object.assign');
7+
8+
gulp.task('build-html-es6', function () {
9+
return gulp.src(paths.html)
10+
.pipe(gulp.dest(paths.output + 'es6'));
11+
});
12+
13+
gulp.task('build-es6', ['build-html-es6'], function () {
14+
return gulp.src(paths.source)
15+
.pipe(gulp.dest(paths.output + 'es6'));
16+
});
17+
18+
gulp.task('build-html-commonjs', function () {
19+
return gulp.src(paths.html)
20+
.pipe(gulp.dest(paths.output + 'commonjs'));
21+
});
22+
23+
gulp.task('build-commonjs', ['build-html-commonjs'], function () {
24+
return gulp.src(paths.source)
25+
.pipe(to5(assign({}, compilerOptions, {modules:'common'})))
26+
.pipe(gulp.dest(paths.output + 'commonjs'));
27+
});
28+
29+
gulp.task('build-html-amd', function () {
30+
return gulp.src(paths.html)
31+
.pipe(gulp.dest(paths.output + 'amd'));
32+
});
33+
34+
gulp.task('build-amd', ['build-html-amd'], function () {
35+
return gulp.src(paths.source)
36+
.pipe(to5(assign({}, compilerOptions, {modules:'amd'})))
37+
.pipe(gulp.dest(paths.output + 'amd'));
38+
});
39+
40+
gulp.task('build-html-system', function () {
41+
return gulp.src(paths.html)
42+
.pipe(gulp.dest(paths.output + 'system'));
43+
});
44+
45+
gulp.task('build-system', ['build-html-system'], function () {
46+
return gulp.src(paths.source)
47+
.pipe(to5(assign({}, compilerOptions, {modules:'system'})))
48+
.pipe(gulp.dest(paths.output + 'system'));
49+
});
50+
51+
gulp.task('build', function(callback) {
52+
return runSequence(
53+
'clean',
54+
['build-es6', 'build-commonjs', 'build-amd', 'build-system'],
55+
callback
56+
);
57+
});

build/tasks/clean.js

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
var gulp = require('gulp');
2+
var paths = require('../paths');
3+
var del = require('del');
4+
var vinylPaths = require('vinyl-paths');
5+
6+
gulp.task('clean', function() {
7+
return gulp.src([paths.output])
8+
.pipe(vinylPaths(del));
9+
});

build/tasks/dev.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
var gulp = require('gulp');
2+
var tools = require('aurelia-tools');
3+
4+
gulp.task('update-own-deps', function(){
5+
tools.updateOwnDependenciesFromLocalRepositories();
6+
});
7+
8+
gulp.task('build-dev-env', function () {
9+
tools.buildDevEnv();
10+
});

build/tasks/doc.js

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
var gulp = require('gulp');
2+
var tools = require('aurelia-tools');
3+
var paths = require('../paths');
4+
var yuidoc = require('gulp-yuidoc');
5+
6+
gulp.task('doc-generate', function(){
7+
return gulp.src(paths.source)
8+
.pipe(yuidoc.parser(null, 'api.json'))
9+
.pipe(gulp.dest(paths.doc));
10+
});
11+
12+
gulp.task('doc', ['doc-generate'], function(){
13+
tools.transformAPIModel(paths.doc);

build/tasks/lint.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
var gulp = require('gulp');
2+
var paths = require('../paths');
3+
var jshint = require('gulp-jshint');
4+
var stylish = require('jshint-stylish');
5+
6+
gulp.task('lint', function() {
7+
return gulp.src(paths.source)
8+
.pipe(jshint())
9+
.pipe(jshint.reporter(stylish));
10+
});

build/tasks/prepare-release.js

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
var gulp = require('gulp');
2+
var runSequence = require('run-sequence');
3+
var paths = require('../paths');
4+
var changelog = require('conventional-changelog');
5+
var fs = require('fs');
6+
var bump = require('gulp-bump');
7+
var args = require('../args');
8+
9+
gulp.task('bump-version', function(){
10+
return gulp.src(['./package.json', './bower.json'])
11+
.pipe(bump({type:args.bump })) //major|minor|patch|prerelease
12+
.pipe(gulp.dest('./'));
13+
});
14+
15+
gulp.task('changelog', function(callback) {
16+
var pkg = JSON.parse(fs.readFileSync('./package.json', 'utf-8'));
17+
18+
return changelog({
19+
repository: pkg.repository.url,
20+
version: pkg.version,
21+
file: paths.doc + '/CHANGELOG.md'
22+
}, function(err, log) {
23+
fs.writeFileSync(paths.doc + '/CHANGELOG.md', log);
24+
});
25+
});
26+
27+
gulp.task('prepare-release', function(callback){
28+
return runSequence(
29+
'build',
30+
'lint',
31+
'bump-version',
32+
'doc',
33+
'changelog',
34+
callback
35+
);
36+
});

build/tasks/test.js

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
var gulp = require('gulp');
2+
var karma = require('karma').server;
3+
4+
/**
5+
* Run test once and exit
6+
*/
7+
gulp.task('test', function (done) {
8+
karma.start({
9+
configFile: __dirname + '/../../karma.conf.js',
10+
singleRun: true
11+
}, function(e) {
12+
done();
13+
});
14+
});
15+
16+
/**
17+
* Watch for file changes and re-run tests on each change
18+
*/
19+
gulp.task('tdd', function (done) {
20+
karma.start({
21+
configFile: __dirname + '/../../karma.conf.js'
22+
}, function(e) {
23+
done();
24+
});
25+
});

config.js

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
System.config({
2+
"baseURL": "/",
3+
"transpiler": "babel",
4+
"babelOptions": {
5+
"optional": [
6+
"runtime"
7+
]
8+
},
9+
"paths": {
10+
"*": "*.js",
11+
"github:*": "jspm_packages/github/*.js",
12+
"npm:*": "jspm_packages/npm/*.js"
13+
}
14+
});
15+
16+
System.config({
17+
"map": {
18+
"babel": "npm:babel-core@5.1.11",
19+
"babel-runtime": "npm:babel-runtime@5.1.11",
20+
"core-js": "npm:core-js@0.8.4",
21+
"github:jspm/nodelibs-process@0.1.1": {
22+
"process": "npm:process@0.10.1"
23+
},
24+
"npm:core-js@0.8.4": {
25+
"process": "github:jspm/nodelibs-process@0.1.1"
26+
}
27+
}
28+
});
29+

gulpfile.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// all gulp tasks are located in the ./build/tasks directory
2+
// gulp configuration is in files in ./build directory
3+
require('require-dir')('build/tasks');

package.json

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"name": "aurelia-modal",
3+
"version": "0.0.1",
4+
"description": "An Aurelia implementation of Bootstrap modal",
5+
"keywords": [
6+
"aurelia",
7+
"plugin",
8+
"modal",
9+
"bootstrap"
10+
],
11+
"homepage": "http://aurelia.io",
12+
"bugs": {
13+
"url": "https://github.com/pwkad/aurelia-modal/issues"
14+
},
15+
"license": "MIT",
16+
"author": "Rob Eisenberg <rob@bluespire.com> (http://robeisenberg.com/)",
17+
"main": "dist/commonjs/index.js",
18+
"repository": {
19+
"type": "git",
20+
"url": "http://github.com/pwkad/aurelia-modal"
21+
},
22+
"jspm": {
23+
"directories": {},
24+
"devDependencies": {
25+
"babel": "npm:babel-core@^5.0.12",
26+
"babel-runtime": "npm:babel-runtime@^5.0.12",
27+
"core-js": "npm:core-js@^0.8.1"
28+
}
29+
}
30+
}

src/index.js

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// import {Modal} from './modal';
2+
// export {Modal} from './modal';
3+
4+
export function install(aurelia, cb){
5+
if(cb === undefined || typeof cb !== 'function') {
6+
throw 'You need to provide a callback method to properly configure the library';
7+
}
8+
9+
aurelia.globalizeResources('./modal');
10+
aurelia.globalizeResources('./modal-header');
11+
aurelia.globalizeResources('./modal-body');
12+
aurelia.globalizeResources('./modal-footer');
13+
var instance = new Modal();
14+
aurelia.container.registerInstance(Modal, instance);
15+
16+
return cb(instance);

src/modal-body.html

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<template>
2+
<div class="modal-body">
3+
<compose view-model.bind="content"></compose>
4+
</div>
5+
</template>

src/modal-body.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import {bindable} from 'aurelia-framework';
2+
3+
export class ModalBody {
4+
@bindable content;
5+
}

src/modal-close.js

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import {inject, customAttribute} from 'aurelia-framework';
2+
3+
@customAttribute('close-modal')
4+
@inject(Element)
5+
export class CloseModal {
6+
constructor(element) {
7+
this.element = element;
8+
}
9+
}

src/modal-footer.html

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<template>
2+
<div class="modal-footer">
3+
<button type="button" class="btn btn-default" repeat.for="button of buttons">${button}</button>
4+
</div>
5+
</template>

src/modal-footer.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import {bindable} from 'aurelia-framework';
2+
3+
export class Footer {
4+
@bindable buttons = [];
5+
}

0 commit comments

Comments
 (0)