diff --git a/src/brick-menu.css b/dist/brick-menu.html
old mode 100755
new mode 100644
similarity index 91%
rename from src/brick-menu.css
rename to dist/brick-menu.html
index 89e2cee..9f72941
--- a/src/brick-menu.css
+++ b/dist/brick-menu.html
@@ -1,4 +1,4 @@
-/**
+
+
+
+
\ No newline at end of file
diff --git a/dist/brick-menu.js b/dist/brick-menu.js
new file mode 100644
index 0000000..12a22f1
--- /dev/null
+++ b/dist/brick-menu.js
@@ -0,0 +1,10 @@
+(function () {
+
+ var BrickMenuElementPrototype = Object.create(HTMLElement.prototype);
+
+ // Register the element
+ window.BrickMenuElement = document.registerElement('brick-menu', {
+ prototype: BrickMenuElementPrototype
+ });
+
+})();
diff --git a/gulpfile.js b/gulpfile.js
index a4b8d7b..c81282b 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -8,12 +8,15 @@ var ghpages = require('gulp-gh-pages');
var gulp = require('gulp');
var helptext = require('gulp-helptext');
var jshint = require('gulp-jshint');
+var rm = require('gulp-rm');
var stylus = require('gulp-stylus');
+var vulcanize = require('gulp-vulcanize');
var paths = {
'main': 'src/brick-menu.html',
'scripts': 'src/*.js',
'stylesheets': 'src/*.styl',
+ 'themes': 'src/themes/**/*.styl',
'src': 'src/*',
'index': 'index.html',
'bowerComponents': 'bower_components/**/*'
@@ -26,15 +29,40 @@ gulp.task('lint', function() {
});
gulp.task('styles', function() {
- gulp.src(paths.stylesheets)
+ return gulp.src(paths.stylesheets)
.pipe(stylus())
.pipe(concat('brick-menu.css'))
.pipe(gulp.dest('src'));
});
-// build scripts and styles
-gulp.task('build', ['lint','styles']);
+gulp.task('themes', function() {
+ return gulp.src(paths.themes)
+ .pipe(stylus())
+ .pipe(gulp.dest('src/themes/'));
+});
+gulp.task('clean', ['vulcanize'], function() {
+ gulp.src(['src/*.css', 'src/themes/**/*.css'])
+ .pipe(rm());
+});
+
+gulp.task('vulcanize', ['styles','themes'], function() {
+ return gulp.src('src/brick-menu.html')
+ .pipe(vulcanize({
+ excludes: {
+ imports: ['bower_components'],
+ scripts: ['bower_components'],
+ styles: ['bower_components']
+ },
+ dest: 'dist',
+ csp: true,
+ inline: true
+ }))
+ .pipe(gulp.dest('dist'));
+});
+
+// build scripts and styles
+gulp.task('build', ['lint','styles','themes','vulcanize', 'clean']);
gulp.task('connect', function() {
connect.server({
@@ -42,10 +70,10 @@ gulp.task('connect', function() {
});
});
-
gulp.task('watch', function () {
gulp.watch(paths.scripts, ['lint']);
- gulp.watch(paths.stylesheets, ['styles']);
+ gulp.watch(paths.stylesheets, ['build']);
+ gulp.watch(paths.themes, ['build']);
});
// do a build, start a server, watch for changes
@@ -61,7 +89,9 @@ gulp.task('bump', function(){
gulp.task('help', helptext({
'default': 'Shows the help message',
'help': 'This help message',
- 'styles': 'Compiles stylus',
+ 'styles': 'Compiles main stylus',
+ 'themes': 'Compiles themes stylus',
+ 'vulcanize': 'Vulcanizes to component html file',
'lint': 'Runs JSHint on your code',
'server': 'Starts the development server',
'bump': 'Bumps up the Version',
diff --git a/index.html b/index.html
index 04a3486..55f06e8 100644
--- a/index.html
+++ b/index.html
@@ -9,17 +9,13 @@
-
+
-
+
- item 1
+ item 1
item 2
item 3
item 4
@@ -28,7 +24,7 @@
- item 1
+ item 1
item 2
item 3
item 4
diff --git a/package.json b/package.json
index f9fdc5c..5557eb2 100644
--- a/package.json
+++ b/package.json
@@ -29,7 +29,10 @@
"gulp-gh-pages": "^0.3.3",
"gulp-helptext": "0.0.6",
"gulp-jshint": "^1.6.1",
+ "gulp-rm": "^0.2.0",
"gulp-stylus": "^1.0.1",
+ "gulp-util": "^3.0.0",
+ "gulp-vulcanize": "^0.2.1",
"karma": "^0.12.16",
"karma-chai": "^0.1.0",
"karma-firefox-launcher": "^0.1.3",
diff --git a/src/brick-menu.html b/src/brick-menu.html
index 746724a..bef0edd 100644
--- a/src/brick-menu.html
+++ b/src/brick-menu.html
@@ -1,2 +1,3 @@
+
diff --git a/src/brick-menu.js b/src/brick-menu.js
index 1b13cae..12a22f1 100644
--- a/src/brick-menu.js
+++ b/src/brick-menu.js
@@ -1,42 +1,7 @@
(function () {
- function delegateChild(handler) {
- return function(e) {
- var target = e.target;
- var delegateEl = e.currentTarget;
- for (var el = target; el.parentNode && el !== delegateEl; el = el.parentNode) {
- if (delegateEl === el.parentNode) {
- handler.call(el, e);
- return;
- }
- }
- };
- }
-
- function _selectItem(item) {
- var selectedItems = item.parentNode.querySelectorAll('*[selected]');
- for (var i = 0; i < selectedItems.length; i++) {
- selectedItems[i].removeAttribute('selected');
- }
- item.setAttribute('selected', true);
- }
-
var BrickMenuElementPrototype = Object.create(HTMLElement.prototype);
- BrickMenuElementPrototype.attachedCallback = function () {
- var self = this;
- self.selectHandler = delegateChild(function(){
- _selectItem(this);
- });
- self.addEventListener("click", self.selectHandler);
- self.addEventListener("select", self.selectHandler);
- };
-
- BrickMenuElementPrototype.detachedCallback = function () {
- this.removeEventListener("click", this.selectHandler);
- this.removeEventListener("select", this.selectHandler);
- };
-
// Register the element
window.BrickMenuElement = document.registerElement('brick-menu', {
prototype: BrickMenuElementPrototype
diff --git a/src/brick-menu.styl b/src/brick-menu.styl
index 920073d..c257b29 100644
--- a/src/brick-menu.styl
+++ b/src/brick-menu.styl
@@ -49,6 +49,10 @@ responsify(selector, attr, content) {
brick-menu {
flexbox();
+ width: 100%;
+ margin: 0;
+ padding: 0;
+
// vertical
flex-direction: column;
diff --git a/src/themes/default/default.styl b/src/themes/default/default.styl
new file mode 100644
index 0000000..f6868be
--- /dev/null
+++ b/src/themes/default/default.styl
@@ -0,0 +1,44 @@
+$color-alpha = #333;
+$color-beta = #FFF;
+$color-gamma = #4D4D4D;
+$color-delta = #5F5F5F;
+$color-epsilon = #858585;
+$color-zeta = #A6A6A6;
+$color-eta = #C7C7C7;
+$color-theta = #E7E7E7;
+$color-iota = #F4F4F4;
+$button-transition = all 0s;
+$button-transition-delay = 300ms;
+$dim-micro = 6px;
+$dim-small = 14px;
+$dim-mega = 60px;
+$highlight-color = #000;
+
+// TODO: icons + icon sizing
+
+brick-menu {
+
+ padding: 0 $dim-small;
+ box-sizing: border-box;
+ & > * {
+ color: $color-gamma;
+ padding: $dim-small 0;
+ border-bottom: 1px solid $color-theta;
+ &:last-child {
+ border-bottom: none;
+ }
+ }
+
+ &[horizontal] {
+ padding: $dim-small 0;
+ & > * {
+ padding: 0 $dim-small;
+ border-bottom: none;
+ border-right: 1px solid $color-theta;
+ &:last-child {
+ border-right: none;
+ }
+ }
+ }
+
+}