From d3cec695961d982a7d8b2ba8a54270fcae14fc11 Mon Sep 17 00:00:00 2001 From: Doug Fritz Date: Wed, 3 Sep 2014 16:14:14 -0700 Subject: [PATCH 1/9] update gulpfile and add a linter --- gulpfile.js | 133 ++++++++++++++++++++++++++------------------------- package.json | 3 ++ 2 files changed, 71 insertions(+), 65 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 5b332c1..7e2098f 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1,88 +1,91 @@ -var gulp = require( 'gulp' ), - stylus = require( 'gulp-stylus' ), - plates = require( 'gulp-plates' ), - rename = require( 'gulp-rename' ), - vulcan = require( 'gulp-vulcanize' ), - insert = require( 'gulp-insert' ), - replace = require( 'gulp-replace' ), - clean = require( 'gulp-clean' ), - nib = require( 'nib' ), - fs = require( 'fs' ), - marked = require( 'marked' ), - karma = require( 'karma' ); +var gulp = require('gulp'), + $ = require('gulp-load-plugins')(), + nib = require('nib'), + fs = require('fs'), + marked = require('marked'), + karma = require('karma'); -gulp.task( 'default', [ 'docs', 'build' ] ); +gulp.task('default', ['docs', 'build']); -gulp.task( 'watch', [ 'default' ], function() { - - karma.server.start( { - frameworks: [ 'jasmine' ], - files: [ - 'build/gui.js', - 'tests/*.js' - ] - } ); +gulp.task('watch', ['default'], function() { - gulp.watch( [ 'elements/**/*.styl', 'elements/**/*.html', 'elements/**/*.js', 'gui.html' ], [ 'build' ] ); - gulp.watch( [ 'README.md', 'docs/*' ], [ 'docs' ] ); + karma.server.start({ + frameworks: ['jasmine'], + files: [ + 'build/gui.js', + 'tests/*.js' + ] + }); -} ); + gulp.watch(['elements/**/*.styl', 'elements/**/*.html', + 'elements/**/*.js', 'gui.html'], ['build']); + gulp.watch(['README.md', 'docs/*'], ['docs']); -gulp.task( 'build', [ 'vulcanize' ], function() { +}); - return gulp.src( 'build/gui.html' ) - .pipe( replace( /\\/g, "\\\\" ) ) - .pipe( replace( /'/g, "\\'" ) ) - .pipe( replace( /^(.*)$/gm, "'$1'," ) ) - .pipe( insert.wrap( 'document.write([', '].join("\\n"))' ) ) - .pipe( rename( 'gui.js' ) ) - .pipe( gulp.dest( 'build' ) ); +gulp.task('build', ['vulcanize'], function() { -} ); + return gulp.src('build/gui.html') + .pipe($.replace(/\\/g, '\\\\')) + .pipe($.replace(/'/g, "\\'")) + .pipe($.replace(/^(.*)$/gm, "'$1',")) + .pipe($.insert.wrap('document.write([', '].join("\\n"))')) + .pipe(rename('gui.js')) + .pipe(gulp.dest('build')); -gulp.task( 'vulcanize', [ 'css' ], function() { +}); - return gulp.src( 'gui.html' ) - .pipe( vulcan( { - dest: 'build', - inline: true, - strip: true - } ) ); +gulp.task('vulcanize', ['css'], function() { -} ); + return gulp.src('gui.html') + .pipe($.vulcanize({ + dest: 'build', + inline: true, + strip: true + })); -gulp.task( 'css', function() { +}); - return css( 'elements/**/*.styl', 'elements' ); +gulp.task('lint', function() { + return gulp.src('elements/**/*.js') + //.pipe($.reload({stream: true, once: true})) + .pipe($.jshint()) + .pipe($.jshint.reporter('jshint-stylish')); + //.pipe($.if(!browserSync.active, $.jshint.reporter('fail'))); +}); -} ); +gulp.task('css', function() { -gulp.task( 'docs', function() { - - css( 'docs/*.styl', 'docs' ); + return css('elements/**/*.styl', 'elements'); - var content = { - readme: marked( fs.readFileSync( 'README.md', 'utf8' ) ) - }; +}); - return gulp.src( 'docs/template.html' ) - .pipe( plates( content ) ) - .pipe( rename( 'index.html' ) ) - .pipe( gulp.dest( './' ) ); +gulp.task('docs', function() { -} ); + css('docs/*.styl', 'docs'); -gulp.task( 'clean', function() { + var content = { + readme: marked(fs.readFileSync('README.md', 'utf8')) + }; - return gulp.src( [ 'build/*', '**/*.css' ] ) - .pipe( clean() ); + return gulp.src('docs/template.html') + .pipe($.plates(content)) + .pipe($.rename('index.html')) + .pipe(gulp.dest('./')); -} ); +}); -function css( src, dest ) { +gulp.task('clean', function() { - return gulp.src( src ) - .pipe( stylus( { use: [ nib() ] } ) ) - .pipe( gulp.dest( dest ) ); + return gulp.src(['build/*', '**/*.css']) + .pipe($.clean()); -} \ No newline at end of file +}); + +function css(src, dest) { + + return gulp.src(src) + .pipe($.stylus({ use: [nib()] })) + .pipe(gulp.dest(dest)); + +} diff --git a/package.json b/package.json index 75931dc..2a5bee7 100644 --- a/package.json +++ b/package.json @@ -5,12 +5,15 @@ "gulp": "^3.8.7", "gulp-clean": "^0.3.1", "gulp-insert": "^0.4.0", + "gulp-jshint": "^1.8.4", + "gulp-load-plugins": "^0.6.0", "gulp-plates": "0.0.5", "gulp-rename": "^1.2.0", "gulp-replace": "^0.4.0", "gulp-stylus": "^1.3.0", "gulp-vulcanize": "^1.0.0", "gulp-watch": "^0.6.9", + "jshint-stylish": "^0.4.0", "karma": "^0.12.23", "karma-chrome-launcher": "^0.1.4", "karma-jasmine": "^0.1.5", From 7f409799dd3a9493977be6ab53d86e6abaed116e Mon Sep 17 00:00:00 2001 From: Doug Fritz Date: Wed, 3 Sep 2014 16:33:28 -0700 Subject: [PATCH 2/9] add gjslint style linter and updated javascript to match --- elements/Gui.js | 248 +++++------ elements/controller-base/controller-base.js | 75 ++-- .../controller-boolean/controller-boolean.js | 34 +- .../controller-function.js | 12 +- .../controller-number/controller-number.js | 403 +++++++++--------- .../controller-string/controller-string.js | 28 +- elements/gui-panel/gui-panel.js | 181 ++++---- elements/gui-row/gui-row.js | 22 +- gulpfile.js | 6 +- package.json | 3 +- 10 files changed, 508 insertions(+), 504 deletions(-) diff --git a/elements/Gui.js b/elements/Gui.js index d095bfe..b75b083 100644 --- a/elements/Gui.js +++ b/elements/Gui.js @@ -1,141 +1,141 @@ -(function( scope ) { +(function(scope) { - var Gui = function( params ) { + var Gui = function(params) { - if ( !ready ) { - Gui.error( 'Gui not ready. Put your code inside Gui.ready()' ); - } - - params = params || {}; - - var panel = document.createElement( 'gui-panel' ); - - panel.autoPlace = params.autoPlace !== false; - - if ( panel.autoPlace ) { - document.body.appendChild( panel ); - } - - return panel; - - }; - - - // Register custom controllers - // ------------------------------- - - var controllers = {}; - - Gui.register = function( elementName, test ) { - - controllers[ elementName ] = test; - - }; - - - // Returns a controller based on a value - // ------------------------------- - - Gui.getController = function( value ) { - - for ( var type in controllers ) { - - var test = controllers[ type ]; - - if ( test( value ) ) { - - return document.createElement( type ); - - } - - } - - }; - - - // Gui ready handler ... * shakes fist at polymer * - // ------------------------------- - - var ready = false; - var readyHandlers = []; - - document.addEventListener( 'polymer-ready', function() { - - ready = true; - readyHandlers.forEach( function( fnc ) { - - fnc(); - - } ); - - } ); - - Gui.ready = function( fnc ) { - - ready ? fnc() : readyHandlers.push( fnc ); - - }; - - - // Error - // ------------------------------- - - Gui.error = function() { - var args = Array.prototype.slice.apply( arguments ); - args.unshift( 'dat-gui ::' ); - console.error.apply( console, args ); + if (!ready) { + Gui.error('Gui not ready. Put your code inside Gui.ready()'); } - Gui.warn = function() { - var args = Array.prototype.slice.apply( arguments ); - args.unshift( 'dat-gui ::' ); - console.warn.apply( console, args ); + params = params || {}; + + var panel = document.createElement('gui-panel'); + + panel.autoPlace = params.autoPlace !== false; + + if (panel.autoPlace) { + document.body.appendChild(panel); } - - // Old namespaces - // ------------------------------- + return panel; - var dat = {}; - - dat.gui = {}; - dat.gui.GUI = Gui; - dat.GUI = dat.gui.GUI; + }; - dat.color = {}; - dat.color.Color = function() {}; - dat.dom = {}; - dat.dom.dom = function() {}; + // Register custom controllers + // ------------------------------- - dat.controllers = {}; - dat.controllers.Controller = constructor( 'controller-base' ); - dat.controllers.NumberController = constructor( 'controller-number' ); - dat.controllers.FunctionController = constructor( 'controller-function' ); - dat.controllers.ColorController = constructor( 'controller-color' ); - dat.controllers.BooleanController = constructor( 'controller-boolean' ); - dat.controllers.OptionController = constructor( 'controller-option' ); + var controllers = {}; - dat.controllers.NumberControllerBox = dat.controllers.NumberController; - dat.controllers.NumberControllerSlider = dat.controllers.NumberController; - - function constructor( elementName ) { - - return function( object, path ) { - var el = document.createElement( elementName ); - el.watch( object, path ); - return el; - }; + Gui.register = function(elementName, test) { + + controllers[elementName] = test; + + }; + + + // Returns a controller based on a value + // ------------------------------- + + Gui.getController = function(value) { + + for (var type in controllers) { + + var test = controllers[type]; + + if (test(value)) { + + return document.createElement(type); + + } } - - // Export - // ------------------------------- - - scope.dat = dat; - scope.Gui = Gui; + }; -})( this ); + // Gui ready handler ... * shakes fist at polymer * + // ------------------------------- + + var ready = false; + var readyHandlers = []; + + document.addEventListener('polymer-ready', function() { + + ready = true; + readyHandlers.forEach(function(fnc) { + + fnc(); + + }); + + }); + + Gui.ready = function(fnc) { + + ready ? fnc() : readyHandlers.push(fnc); + + }; + + + // Error + // ------------------------------- + + Gui.error = function() { + var args = Array.prototype.slice.apply(arguments); + args.unshift('dat-gui ::'); + console.error.apply(console, args); + }; + + Gui.warn = function() { + var args = Array.prototype.slice.apply(arguments); + args.unshift('dat-gui ::'); + console.warn.apply(console, args); + }; + + + // Old namespaces + // ------------------------------- + + var dat = {}; + + dat.gui = {}; + dat.gui.GUI = Gui; + dat.GUI = dat.gui.GUI; + + dat.color = {}; + dat.color.Color = function() {}; + + dat.dom = {}; + dat.dom.dom = function() {}; + + dat.controllers = {}; + dat.controllers.Controller = constructor('controller-base'); + dat.controllers.NumberController = constructor('controller-number'); + dat.controllers.FunctionController = constructor('controller-function'); + dat.controllers.ColorController = constructor('controller-color'); + dat.controllers.BooleanController = constructor('controller-boolean'); + dat.controllers.OptionController = constructor('controller-option'); + + dat.controllers.NumberControllerBox = dat.controllers.NumberController; + dat.controllers.NumberControllerSlider = dat.controllers.NumberController; + + function constructor(elementName) { + + return function(object, path) { + var el = document.createElement(elementName); + el.watch(object, path); + return el; + }; + + } + + + // Export + // ------------------------------- + + scope.dat = dat; + scope.Gui = Gui; + + +})(this); diff --git a/elements/controller-base/controller-base.js b/elements/controller-base/controller-base.js index 92405ce..4bcf251 100644 --- a/elements/controller-base/controller-base.js +++ b/elements/controller-base/controller-base.js @@ -1,71 +1,72 @@ /* -[ ] onChange( ) -[ ] onFinishChange( ) +[ ] onChange() +[ ] onFinishChange() */ Polymer('controller-base', { - ready: function() { + ready: function() { - this.update(); + this.update(); - }, + }, - update: function() {}, + update: function() {}, - init: function() {}, + init: function() {}, - // Observers - // ------------------------------- + // Observers + // ------------------------------- - watch: function( object, path ) { + watch: function(object, path) { - this.object = object; - this.path = path; + this.object = object; + this.path = path; - this.bind('value', new PathObserver(this.object, this.path)); + this.bind('value', new PathObserver(this.object, this.path)); - }, + }, - valueChanged: function() { - - this.update(); + valueChanged: function() { - }, + this.update(); + + }, - // Helpers - // ------------------------------- + // Helpers + // ------------------------------- - map: function( x, a, b, c, d ) { - return ( x - a ) / ( b - a ) * ( d - c ) + c; - }, + map: function(x, a, b, c, d) { + return (x - a) / (b - a) * (d - c) + c; + }, - // Legacy - // ------------------------------- + // Legacy + // ------------------------------- - listen: function() { + listen: function() { - Gui.warn( 'controller.listen() is deprecated. All controllers are listened for free.' ); - return this; + Gui.warn('controller.listen() is deprecated. ' + + 'All controllers are listened for free.'); + return this; - }, + }, - getValue: function() { + getValue: function() { - return this.value; + return this.value; - }, + }, - setValue: function( v ) { + setValue: function(v) { - this.value = v; + this.value = v; - } - + } -}); \ No newline at end of file + +}); diff --git a/elements/controller-boolean/controller-boolean.js b/elements/controller-boolean/controller-boolean.js index efa820e..288c03f 100644 --- a/elements/controller-boolean/controller-boolean.js +++ b/elements/controller-boolean/controller-boolean.js @@ -1,20 +1,20 @@ -Gui.register( 'controller-boolean', function( value ) { - - return typeof value == 'boolean'; +Gui.register('controller-boolean', function(value) { -} ); + return typeof value == 'boolean'; + +}); + +Polymer('controller-boolean', { + + ready: function() { + + + }, + + toggle: function() { + + this.value = !this.value; + + } -Polymer( 'controller-boolean', { - - ready: function() { - - - }, - - toggle: function() { - - this.value = !this.value; - - } - }); diff --git a/elements/controller-function/controller-function.js b/elements/controller-function/controller-function.js index 511a1c9..cdb02c8 100644 --- a/elements/controller-function/controller-function.js +++ b/elements/controller-function/controller-function.js @@ -1,9 +1,9 @@ -Gui.register( 'controller-function', function( value ) { - - return typeof value == 'function'; +Gui.register('controller-function', function(value) { -} ); + return typeof value == 'function'; -Polymer( 'controller-function', { +}); -} ); +Polymer('controller-function', { + +}); diff --git a/elements/controller-number/controller-number.js b/elements/controller-number/controller-number.js index 7bd5a07..7de74d6 100644 --- a/elements/controller-number/controller-number.js +++ b/elements/controller-number/controller-number.js @@ -1,7 +1,7 @@ /* [ ] arrow keys -[ ] min( ) max( ) step( ) commands of yore +[ ] min() max() step() commands of yore [x] only validate input box on blur, not on keydown [x] enter key blurs @@ -13,251 +13,252 @@ */ -Gui.register( 'controller-number', function( value ) { - - return typeof value == 'number'; +Gui.register('controller-number', function(value) { -} ); + return typeof value == 'number'; -Polymer( 'controller-number', { +}); - value: 0, - decimals: 3, - computed: { +Polymer('controller-number', { - slider: 'min !== undefined && max !== undefined' + value: 0, + decimals: 3, + computed: { - }, + slider: 'min !== undefined && max !== undefined' - ready: function() { - - var _this = this; + }, - window.addEventListener( 'keydown', function( e ) { - if ( e.keyCode == 18 ) _this._alt = true; - }, false ); + ready: function() { - window.addEventListener( 'keyup', function( e ) { - if ( e.keyCode == 18 ) _this._alt = false; - }, false ); + var _this = this; - this.super(); + window.addEventListener('keydown', function(e) { + if (e.keyCode == 18) _this._alt = true; + }, false); - }, + window.addEventListener('keyup', function(e) { + if (e.keyCode == 18) _this._alt = false; + }, false); - init: function( min, max, step ) { + this.super(); - this.min = min; - this.max = max; - this.step = step; + }, - }, + init: function(min, max, step) { - // Observers - // ------------------------------- + this.min = min; + this.max = max; + this.step = step; - valueChanged: function( newValue ) { + }, - if ( this.step !== undefined ) { - this.value = Math.round( this.value / this.step ) * this.step; - } + // Observers + // ------------------------------- - if ( this.min !== undefined ) { - this.value = Math.max( this.value, this.min ); - } + valueChanged: function(newValue) { - if ( this.max !== undefined ) { - this.value = Math.min( this.value, this.max ); - } - - this.super(); - }, + if (this.step !== undefined) { + this.value = Math.round(this.value / this.step) * this.step; + } - minChanged: function() { + if (this.min !== undefined) { + this.value = Math.max(this.value, this.min); + } - this.value = Math.max( this.value, this.min ); - this.update(); + if (this.max !== undefined) { + this.value = Math.min(this.value, this.max); + } - }, + this.super(); + }, - maxChanged: function() { + minChanged: function() { - this.value = Math.min( this.value, this.max ); - this.update(); + this.value = Math.max(this.value, this.min); + this.update(); - }, + }, - update: function() { - - var ratio = this.map( this.value, this.min, this.max, 0, 1 ); + maxChanged: function() { - if ( this.min < 0 && this.max > 0 ) { + this.value = Math.min(this.value, this.max); + this.update(); - this.$.container.classList.add( 'straddle-zero' ); + }, - var zero = this.map( 0, this.min, this.max, 0, 1 ); + update: function() { - if ( this.value >= 0 ) { + var ratio = this.map(this.value, this.min, this.max, 0, 1); - this.$.fill.style.left = zero * 100 + '%'; - this.$.fill.style.width = (ratio - zero) * 100 + '%'; - this.$.fill.style.right = ''; + if (this.min < 0 && this.max > 0) { - } else { + this.$.container.classList.add('straddle-zero'); - this.$.fill.style.left = ''; - this.$.fill.style.width = (zero - ratio) * 100 + '%'; - this.$.fill.style.right = ( 1 - zero ) * 100 + '%'; + var zero = this.map(0, this.min, this.max, 0, 1); - } + if (this.value >= 0) { - } else { + this.$.fill.style.left = zero * 100 + '%'; + this.$.fill.style.width = (ratio - zero) * 100 + '%'; + this.$.fill.style.right = ''; - this.$.container.classList.remove( 'straddle-zero' ); + } else { - if ( this.max > 0 ) { + this.$.fill.style.left = ''; + this.$.fill.style.width = (zero - ratio) * 100 + '%'; + this.$.fill.style.right = (1 - zero) * 100 + '%'; - this.$.fill.style.left = 0; - this.$.fill.style.width = ratio * 100 + '%'; - this.$.fill.style.right = ''; + } - } else { + } else { - this.$.fill.style.left = ''; - this.$.fill.style.width = ( 1 - ratio ) * 100 + '%'; - this.$.fill.style.right = 0; + this.$.container.classList.remove('straddle-zero'); - } + if (this.max > 0) { - } + this.$.fill.style.left = 0; + this.$.fill.style.width = ratio * 100 + '%'; + this.$.fill.style.right = ''; - this.$.knob.style.left = ratio * 100 + '%'; + } else { - this.$.container.classList.toggle( 'positive', this.value >= 0 ); - this.$.container.classList.toggle( 'negative', this.value < 0 ); + this.$.fill.style.left = ''; + this.$.fill.style.width = (1 - ratio) * 100 + '%'; + this.$.fill.style.right = 0; - this.super(); - - }, - - - // Events - // ------------------------------- - - click: function( e ) { - - this.$.input.select(); - - }, - - keydown: function( e ) { - - if ( e.keyCode == 13 ) { - this.$.input.blur(); - } - - }, - - down: function( e ) { - - e.preventDefault(); - this._rect = this.$.track.getBoundingClientRect(); - if ( !this._alt ) this.value = this.valueFromX( e.x ); - - }, - - up: function( e ) { - - // this.$.container.classList.add( 'transition' ); - - }, - - trackstart: function( e ) { - - // this.$.container.classList.remove( 'transition' ); - this._dragFriction = 1; - - }, - - trackx: function( e ) { - - if ( this.step === undefined ) { - - var dv = this.valueFromDX( e.ddx ); - - if ( this._alt ) dv /= 10; - - this.value += dv * this._dragFriction; - - } else { - - this.value = this.valueFromX( e.pageX ); - - } - }, - - tracky: function( e ) { - - this._dragFriction = Math.max( 0.01, Math.min( 1, this.map( e.dy, 50, 300, 1, 0.1 ) ) ); - - }, - - blur: function( e ) { - - var v = parseFloat( this.$.input.value ); - - if ( v === v ) { - this.value = v; - } - - }, - - - - // Filters - // ------------------------------- - - truncate: function( v ) { - - if ( v % 1 !== 0 && this.decimals !== undefined ) { - return this.limitDecimals( v, this.decimals ); - } else { - return v; - } - - }, - - - // Helpers - // ------------------------------- - - limitDecimals: function( v, maxDecimals ) { - - var str = v.toString(); - var numDecimals = str.substring( str.indexOf( '.' ) + 1 ).length; - - str = v.toFixed( Math.min( numDecimals, this.decimals ) ); - - for ( var z, i = 0, l = str.length; i < l; i++ ) { - if ( str.charAt( i ) !== '0' ) { - z = i; - } - } - - return str.substring( 0, z+1 ); - - }, - - valueFromX: function( x ) { - - return this.map( x, this._rect.left, this._rect.right, this.min, this.max ); - - }, - - valueFromDX: function( dx ) { - - return this.map( dx, 0, this._rect.width, 0, this.max - this.min ); + } } + this.$.knob.style.left = ratio * 100 + '%'; + + this.$.container.classList.toggle('positive', this.value >= 0); + this.$.container.classList.toggle('negative', this.value < 0); + + this.super(); + + }, + + + // Events + // ------------------------------- + + click: function(e) { + + this.$.input.select(); + + }, + + keydown: function(e) { + + if (e.keyCode == 13) { + this.$.input.blur(); + } + + }, + + down: function(e) { + + e.preventDefault(); + this._rect = this.$.track.getBoundingClientRect(); + if (!this._alt) this.value = this.valueFromX(e.x); + + }, + + up: function(e) { + + // this.$.container.classList.add( 'transition'); + + }, + + trackstart: function(e) { + + // this.$.container.classList.remove( 'transition'); + this._dragFriction = 1; + + }, + + trackx: function(e) { + + if (this.step === undefined) { + + var dv = this.valueFromDX(e.ddx); + + if (this._alt) dv /= 10; + + this.value += dv * this._dragFriction; + + } else { + + this.value = this.valueFromX(e.pageX); + + } + }, + + tracky: function(e) { + + this._dragFriction = Math.max(0.01, + Math.min(1, this.map(e.dy, 50, 300, 1, 0.1))); + + }, + + blur: function(e) { + + var v = parseFloat(this.$.input.value); + + if (v === v) { + this.value = v; + } + + }, + + + + // Filters + // ------------------------------- + + truncate: function(v) { + + if (v % 1 !== 0 && this.decimals !== undefined) { + return this.limitDecimals(v, this.decimals); + } else { + return v; + } + + }, + + + // Helpers + // ------------------------------- + + limitDecimals: function(v, maxDecimals) { + + var str = v.toString(); + var numDecimals = str.substring(str.indexOf('.') + 1).length; + + str = v.toFixed(Math.min(numDecimals, this.decimals)); + + for (var z, i = 0, l = str.length; i < l; i++) { + if (str.charAt(i) !== '0') { + z = i; + } + } + + return str.substring(0, z + 1); + + }, + + valueFromX: function(x) { + + return this.map(x, this._rect.left, this._rect.right, this.min, this.max); + + }, + + valueFromDX: function(dx) { + + return this.map(dx, 0, this._rect.width, 0, this.max - this.min); + + } + }); diff --git a/elements/controller-string/controller-string.js b/elements/controller-string/controller-string.js index b60b1eb..094b074 100644 --- a/elements/controller-string/controller-string.js +++ b/elements/controller-string/controller-string.js @@ -1,23 +1,23 @@ -Gui.register( 'controller-string', function( value ) { - - return typeof value == 'string'; +Gui.register('controller-string', function(value) { -} ); + return typeof value == 'string'; -Polymer( 'controller-string', { +}); - click: function( e ) { +Polymer('controller-string', { - this.$.input.select(); + click: function(e) { - }, + this.$.input.select(); - keydown: function( e ) { + }, - if ( e.keyCode == 13 ) { - this.$.input.blur(); - } + keydown: function(e) { + if (e.keyCode == 13) { + this.$.input.blur(); } - -}); \ No newline at end of file + + } + +}); diff --git a/elements/gui-panel/gui-panel.js b/elements/gui-panel/gui-panel.js index 8d23360..efedc3f 100644 --- a/elements/gui-panel/gui-panel.js +++ b/elements/gui-panel/gui-panel.js @@ -3,139 +3,142 @@ Polymer('gui-panel', { - docked: false, - open: true, - touch: 'ontouchstart' in window || !!window.DocumentTouch && document instanceof DocumentTouch, + docked: false, + open: true, + touch: ('ontouchstart' in window) || + (!!window.DocumentTouch && document instanceof DocumentTouch), - ready: function() { + ready: function() { - this.anon.values = {}; + this.anon.values = {}; - // window.addEventListener( 'resize', this.checkHeight.bind( this ) ); + // window.addEventListener( 'resize', this.checkHeight.bind( this)); - }, + }, - anon: function() { + anon: function() { - if ( arguments.length == 1 ) { - var name = arguments[ 0 ]; - return this.anon.values[ name ]; - } + if (arguments.length == 1) { + var name = arguments[0]; + return this.anon.values[name]; + } - var initialValue = arguments[ 0 ]; - var name = arguments[ 1 ]; + var initialValue = arguments[0]; + var name = arguments[1]; - var args = [ this.anon.values, name ]; - args = args.concat( Array.prototype.slice.call( arguments, 2 ) ); + var args = [this.anon.values, name]; + args = args.concat(Array.prototype.slice.call(arguments, 2)); - this.anon.values[ name ] = initialValue; + this.anon.values[name] = initialValue; - return this.add.apply( this, args ); + return this.add.apply(this, args); - }, + }, - add: function( object, path ) { + add: function(object, path) { - // Make controller + // Make controller - var value = Path.get( path ).getValueFrom( object ); + var value = Path.get(path).getValueFrom(object); - if ( value == null || value == undefined ) { - return Gui.error( object + ' doesn\'t have a value for path "' + path + '".' ); - } + if (value == null || value == undefined) { + return Gui.error(object + + ' doesn\'t have a value for path "' + path + '".'); + } - var args = Array.prototype.slice.call( arguments, 2 ); + var args = Array.prototype.slice.call(arguments, 2); - var controller = Gui.getController( value, args ); - - if ( !controller ) { - return Gui.error( 'Unrecognized type:', value ); - } + var controller = Gui.getController(value, args); - controller.watch( object, path ) - controller.init.apply( controller, args ); + if (!controller) { + return Gui.error('Unrecognized type:', value); + } - // Make row + controller.watch(object, path); + controller.init.apply(controller, args); - var row = document.createElement( 'gui-row' ); - row.name = path; + // Make row - controller.row = row; + var row = document.createElement('gui-row'); + row.name = path; - controller.name = function( name ) { - row.name = name; - }; + controller.row = row; - controller.comment = function( comment ) { - row.comment = comment; - }; + controller.name = function(name) { + row.name = name; + }; - row.appendChild( controller ); - this.appendChild( row ); + controller.comment = function(comment) { + row.comment = comment; + }; - return controller; + row.appendChild(controller); + this.appendChild(row); - }, + return controller; + + }, - // Observers - // ------------------------------- + // Observers + // ------------------------------- - openChanged: function() { + openChanged: function() { - if ( this.open || this.docked ) { - - // let the style sheet take care of things + if (this.open || this.docked) { - this.$.container.style.transform = ''; + // let the style sheet take care of things - } else { + this.$.container.style.transform = ''; - // todo: need the rest of the vendor prefixes ... - // wish i could pipe javascript variables into styl. + } else { - var y = -this.$.controllers.offsetHeight + 'px'; - this.$.container.style.transform = 'translate3d(0, ' + y + ', 0)'; + // todo: need the rest of the vendor prefixes ... + // wish i could pipe javascript variables into styl. - } + var y = -this.$.controllers.offsetHeight + 'px'; + this.$.container.style.transform = 'translate3d(0, ' + y + ', 0)'; + + } - }, + }, - dockedChanged: function() { + dockedChanged: function() { - this.openChanged(); + this.openChanged(); - }, - - - // Events - // ------------------------------- - - tapClose: function() { - this.open = !this.open; - }, - - // checkHeight: function() { - - // if ( window.innerHeight < this.$.controllers.offsetHeight ) { - // this.docked = true; - // } else { - // this.docked = false; - // } - - // }, + }, - // Legacy - // ------------------------------- + // Events + // ------------------------------- - listenAll: function() { + tapClose: function() { + this.open = !this.open; + }, - Gui.warn( 'controller.listenAll() is deprecated. All controllers are listened for free.' ); + // checkHeight: function() { - }, + // if ( window.innerHeight < this.$.controllers.offsetHeight) { + // this.docked = true; + // } else { + // this.docked = false; + // } - // todo: domElement + // }, -}); \ No newline at end of file + + // Legacy + // ------------------------------- + + listenAll: function() { + + Gui.warn('controller.listenAll() is deprecated. ' + + 'All controllers are listened for free.'); + + } + + // todo: domElement + +}); diff --git a/elements/gui-row/gui-row.js b/elements/gui-row/gui-row.js index 70e1ef2..083ff37 100644 --- a/elements/gui-row/gui-row.js +++ b/elements/gui-row/gui-row.js @@ -1,18 +1,18 @@ Polymer('gui-row', { - comment: null, - commentOpen: false, + comment: null, + commentOpen: false, - ready: function() { + ready: function() { - }, + }, - openComment: function() { - this.commentOpen = true; - }, + openComment: function() { + this.commentOpen = true; + }, - closeComment: function() { - this.commentOpen = false; - } + closeComment: function() { + this.commentOpen = false; + } -}); \ No newline at end of file +}); diff --git a/gulpfile.js b/gulpfile.js index 7e2098f..e66e5bd 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -49,9 +49,9 @@ gulp.task('vulcanize', ['css'], function() { gulp.task('lint', function() { return gulp.src('elements/**/*.js') //.pipe($.reload({stream: true, once: true})) - .pipe($.jshint()) - .pipe($.jshint.reporter('jshint-stylish')); - //.pipe($.if(!browserSync.active, $.jshint.reporter('fail'))); + .pipe($.gjslint()) + .pipe($.gjslint.reporter('console', {})); + //.pipe($.if(!browserSync.active, $.gjslint.reporter('fail'))); }); gulp.task('css', function() { diff --git a/package.json b/package.json index 2a5bee7..b2f944e 100644 --- a/package.json +++ b/package.json @@ -4,8 +4,8 @@ "devDependencies": { "gulp": "^3.8.7", "gulp-clean": "^0.3.1", + "gulp-gjslint": "^0.1.2", "gulp-insert": "^0.4.0", - "gulp-jshint": "^1.8.4", "gulp-load-plugins": "^0.6.0", "gulp-plates": "0.0.5", "gulp-rename": "^1.2.0", @@ -13,7 +13,6 @@ "gulp-stylus": "^1.3.0", "gulp-vulcanize": "^1.0.0", "gulp-watch": "^0.6.9", - "jshint-stylish": "^0.4.0", "karma": "^0.12.23", "karma-chrome-launcher": "^0.1.4", "karma-jasmine": "^0.1.5", From 6a017031c6ab50665d676850faa6b3c1ee93782a Mon Sep 17 00:00:00 2001 From: Doug Fritz Date: Wed, 3 Sep 2014 17:13:33 -0700 Subject: [PATCH 3/9] add an editorconfig --- .editorconfig | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..5746b85 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,5 @@ +# 2 space indentation +[*.js] +indent_style = space +indent_size = 2 + From b536c15b1d3fcedea4d31205b388fa486888a75f Mon Sep 17 00:00:00 2001 From: Doug Fritz Date: Wed, 3 Sep 2014 18:25:36 -0700 Subject: [PATCH 4/9] switch to jscs and jshint with a google style flavor --- .jscsrc | 19 +++++++++++++++++++ .jshintrc | 13 +++++++++++++ gulpfile.js | 34 +++++++++++++++++++++------------- package.json | 7 ++++++- 4 files changed, 59 insertions(+), 14 deletions(-) create mode 100644 .jscsrc create mode 100644 .jshintrc diff --git a/.jscsrc b/.jscsrc new file mode 100644 index 0000000..0a13d61 --- /dev/null +++ b/.jscsrc @@ -0,0 +1,19 @@ +{ + "preset": "google", + "fileExtensions": [ ".js" ], + + "requireParenthesesAroundIIFE": true, + "maximumLineLength": 120, + "validateLineBreaks": "LF", + "validateIndentation": 2, + + "disallowKeywords": ["with"], + "disallowSpacesInsideObjectBrackets": null, + "disallowImplicitTypeConversion": ["string"], + + "safeContextKeyword": "_this", + + "excludeFiles": [ + "test/data/**" + ] +} diff --git a/.jshintrc b/.jshintrc new file mode 100644 index 0000000..804f8af --- /dev/null +++ b/.jshintrc @@ -0,0 +1,13 @@ +{ + "node": true, + "esnext": true, + "bitwise": true, + "camelcase": true, + "curly": true, + "immed": true, + "newcap": true, + "noarg": true, + "undef": true, + "unused": "vars", + "strict": true +} diff --git a/gulpfile.js b/gulpfile.js index e66e5bd..9440aa4 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1,9 +1,11 @@ var gulp = require('gulp'), - $ = require('gulp-load-plugins')(), - nib = require('nib'), - fs = require('fs'), - marked = require('marked'), - karma = require('karma'); + $ = require('gulp-load-plugins')(), + nib = require('nib'), + fs = require('fs'), + marked = require('marked'), + karma = require('karma'), + browserSync = require('browser-sync'), + reload = browserSync.reload; gulp.task('default', ['docs', 'build']); @@ -18,7 +20,8 @@ gulp.task('watch', ['default'], function() { }); gulp.watch(['elements/**/*.styl', 'elements/**/*.html', - 'elements/**/*.js', 'gui.html'], ['build']); + 'elements/**/*.js', 'gui.html'], ['build']); + gulp.watch(['README.md', 'docs/*'], ['docs']); }); @@ -27,8 +30,8 @@ gulp.task('build', ['vulcanize'], function() { return gulp.src('build/gui.html') .pipe($.replace(/\\/g, '\\\\')) - .pipe($.replace(/'/g, "\\'")) - .pipe($.replace(/^(.*)$/gm, "'$1',")) + .pipe($.replace(/'/g, '\\\'')) + .pipe($.replace(/^(.*)$/gm, '\'$1\',')) .pipe($.insert.wrap('document.write([', '].join("\\n"))')) .pipe(rename('gui.js')) .pipe(gulp.dest('build')); @@ -42,16 +45,21 @@ gulp.task('vulcanize', ['css'], function() { dest: 'build', inline: true, strip: true - })); + })); }); +gulp.task('jscs', function() { + return gulp.src('elements/**/*.js') + .pipe($.jscs()); +}); + gulp.task('lint', function() { return gulp.src('elements/**/*.js') - //.pipe($.reload({stream: true, once: true})) - .pipe($.gjslint()) - .pipe($.gjslint.reporter('console', {})); - //.pipe($.if(!browserSync.active, $.gjslint.reporter('fail'))); + .pipe(reload({stream: true, once: true})) + .pipe($.jshint()) + .pipe($.jshint.reporter('jshint-stylish')) + .pipe($.if(!browserSync.active, $.jshint.reporter('fail'))); }); gulp.task('css', function() { diff --git a/package.json b/package.json index b2f944e..ec722de 100644 --- a/package.json +++ b/package.json @@ -2,17 +2,22 @@ "name": "dat.gui", "version": "0.0.0", "devDependencies": { + "browser-sync": "^1.3.6", "gulp": "^3.8.7", "gulp-clean": "^0.3.1", - "gulp-gjslint": "^0.1.2", + "gulp-if": "^1.2.4", "gulp-insert": "^0.4.0", + "gulp-jscs": "^1.1.2", + "gulp-jshint": "^1.8.4", "gulp-load-plugins": "^0.6.0", "gulp-plates": "0.0.5", + "gulp-reload": "0.0.4", "gulp-rename": "^1.2.0", "gulp-replace": "^0.4.0", "gulp-stylus": "^1.3.0", "gulp-vulcanize": "^1.0.0", "gulp-watch": "^0.6.9", + "jshint-stylish": "^0.4.0", "karma": "^0.12.23", "karma-chrome-launcher": "^0.1.4", "karma-jasmine": "^0.1.5", From 49649b1ff911f9d99fd32ffd65057c3daf446f50 Mon Sep 17 00:00:00 2001 From: Doug Fritz Date: Wed, 3 Sep 2014 21:14:36 -0700 Subject: [PATCH 5/9] update style for jshint and jscs --- .jshintrc | 2 +- elements/Gui.js | 17 ++++++++--------- elements/controller-base/controller-base.js | 7 +++---- .../controller-boolean/controller-boolean.js | 4 +++- .../controller-function.js | 3 +++ .../controller-number/controller-number.js | 19 +++++++++++-------- .../controller-string/controller-string.js | 3 +++ elements/gui-panel/gui-panel.js | 16 ++++++++-------- elements/gui-row/gui-row.js | 3 +++ 9 files changed, 43 insertions(+), 31 deletions(-) diff --git a/.jshintrc b/.jshintrc index 804f8af..1419d9f 100644 --- a/.jshintrc +++ b/.jshintrc @@ -5,7 +5,7 @@ "camelcase": true, "curly": true, "immed": true, - "newcap": true, + "newcap": false, "noarg": true, "undef": true, "unused": "vars", diff --git a/elements/Gui.js b/elements/Gui.js index b75b083..24d30f6 100644 --- a/elements/Gui.js +++ b/elements/Gui.js @@ -1,4 +1,7 @@ +/* globals document */ + (function(scope) { + 'use strict'; var Gui = function(params) { @@ -20,7 +23,6 @@ }; - // Register custom controllers // ------------------------------- @@ -32,7 +34,6 @@ }; - // Returns a controller based on a value // ------------------------------- @@ -52,7 +53,6 @@ }; - // Gui ready handler ... * shakes fist at polymer * // ------------------------------- @@ -72,11 +72,14 @@ Gui.ready = function(fnc) { - ready ? fnc() : readyHandlers.push(fnc); + if (ready) { + fnc(); + } else { + readyHandlers.push(fnc); + } }; - // Error // ------------------------------- @@ -92,7 +95,6 @@ console.warn.apply(console, args); }; - // Old namespaces // ------------------------------- @@ -129,13 +131,10 @@ } - // Export // ------------------------------- scope.dat = dat; scope.Gui = Gui; - })(this); - diff --git a/elements/controller-base/controller-base.js b/elements/controller-base/controller-base.js index 4bcf251..9674579 100644 --- a/elements/controller-base/controller-base.js +++ b/elements/controller-base/controller-base.js @@ -1,3 +1,6 @@ +/* globals Gui, Polymer, PathObserver */ +'use strict'; + /* [ ] onChange() @@ -17,7 +20,6 @@ Polymer('controller-base', { init: function() {}, - // Observers // ------------------------------- @@ -36,7 +38,6 @@ Polymer('controller-base', { }, - // Helpers // ------------------------------- @@ -44,7 +45,6 @@ Polymer('controller-base', { return (x - a) / (b - a) * (d - c) + c; }, - // Legacy // ------------------------------- @@ -68,5 +68,4 @@ Polymer('controller-base', { } - }); diff --git a/elements/controller-boolean/controller-boolean.js b/elements/controller-boolean/controller-boolean.js index 288c03f..ae1c1f9 100644 --- a/elements/controller-boolean/controller-boolean.js +++ b/elements/controller-boolean/controller-boolean.js @@ -1,3 +1,6 @@ +/* globals Gui, Polymer */ +'use strict'; + Gui.register('controller-boolean', function(value) { return typeof value == 'boolean'; @@ -8,7 +11,6 @@ Polymer('controller-boolean', { ready: function() { - }, toggle: function() { diff --git a/elements/controller-function/controller-function.js b/elements/controller-function/controller-function.js index cdb02c8..c7fa1f6 100644 --- a/elements/controller-function/controller-function.js +++ b/elements/controller-function/controller-function.js @@ -1,3 +1,6 @@ +/* globals Gui, Polymer */ +'use strict'; + Gui.register('controller-function', function(value) { return typeof value == 'function'; diff --git a/elements/controller-number/controller-number.js b/elements/controller-number/controller-number.js index 7de74d6..28e5c94 100644 --- a/elements/controller-number/controller-number.js +++ b/elements/controller-number/controller-number.js @@ -1,3 +1,6 @@ +/* globals Gui, Polymer, window */ +'use strict'; + /* [ ] arrow keys @@ -34,11 +37,15 @@ Polymer('controller-number', { var _this = this; window.addEventListener('keydown', function(e) { - if (e.keyCode == 18) _this._alt = true; + if (e.keyCode == 18) { + _this._alt = true; + } }, false); window.addEventListener('keyup', function(e) { - if (e.keyCode == 18) _this._alt = false; + if (e.keyCode == 18) { + _this._alt = false; + } }, false); this.super(); @@ -140,7 +147,6 @@ Polymer('controller-number', { }, - // Events // ------------------------------- @@ -162,7 +168,7 @@ Polymer('controller-number', { e.preventDefault(); this._rect = this.$.track.getBoundingClientRect(); - if (!this._alt) this.value = this.valueFromX(e.x); + if (!this._alt) { this.value = this.valueFromX(e.x); } }, @@ -185,7 +191,7 @@ Polymer('controller-number', { var dv = this.valueFromDX(e.ddx); - if (this._alt) dv /= 10; + if (this._alt) { dv /= 10; } this.value += dv * this._dragFriction; @@ -213,8 +219,6 @@ Polymer('controller-number', { }, - - // Filters // ------------------------------- @@ -228,7 +232,6 @@ Polymer('controller-number', { }, - // Helpers // ------------------------------- diff --git a/elements/controller-string/controller-string.js b/elements/controller-string/controller-string.js index 094b074..b85fdd0 100644 --- a/elements/controller-string/controller-string.js +++ b/elements/controller-string/controller-string.js @@ -1,3 +1,6 @@ +/* globals Gui, Polymer */ +'use strict'; + Gui.register('controller-string', function(value) { return typeof value == 'string'; diff --git a/elements/gui-panel/gui-panel.js b/elements/gui-panel/gui-panel.js index efedc3f..c285fed 100644 --- a/elements/gui-panel/gui-panel.js +++ b/elements/gui-panel/gui-panel.js @@ -1,3 +1,6 @@ +/* globals Polymer, window, document, Path, Gui */ +'use strict'; + // [ ] scrolling when docked // [ ] scrolling when window short and not docked @@ -6,7 +9,7 @@ Polymer('gui-panel', { docked: false, open: true, touch: ('ontouchstart' in window) || - (!!window.DocumentTouch && document instanceof DocumentTouch), + (!!window.DocumentTouch && document instanceof window.DocumentTouch), ready: function() { @@ -17,14 +20,15 @@ Polymer('gui-panel', { }, anon: function() { + var name; if (arguments.length == 1) { - var name = arguments[0]; + name = arguments[0]; return this.anon.values[name]; } var initialValue = arguments[0]; - var name = arguments[1]; + name = arguments[1]; var args = [this.anon.values, name]; args = args.concat(Array.prototype.slice.call(arguments, 2)); @@ -41,7 +45,7 @@ Polymer('gui-panel', { var value = Path.get(path).getValueFrom(object); - if (value == null || value == undefined) { + if (value === null || value === undefined) { return Gui.error(object + ' doesn\'t have a value for path "' + path + '".'); } @@ -79,7 +83,6 @@ Polymer('gui-panel', { }, - // Observers // ------------------------------- @@ -101,7 +104,6 @@ Polymer('gui-panel', { } - }, dockedChanged: function() { @@ -110,7 +112,6 @@ Polymer('gui-panel', { }, - // Events // ------------------------------- @@ -128,7 +129,6 @@ Polymer('gui-panel', { // }, - // Legacy // ------------------------------- diff --git a/elements/gui-row/gui-row.js b/elements/gui-row/gui-row.js index 083ff37..5a1a8e3 100644 --- a/elements/gui-row/gui-row.js +++ b/elements/gui-row/gui-row.js @@ -1,3 +1,6 @@ +/* globals Polymer */ +'use strict'; + Polymer('gui-row', { comment: null, From 82e4922d3b548653ac5948df3525c3f951f7aec5 Mon Sep 17 00:00:00 2001 From: Doug Fritz Date: Thu, 4 Sep 2014 16:17:59 -0700 Subject: [PATCH 6/9] rename to markdown --- TODO => TODO.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename TODO => TODO.md (100%) diff --git a/TODO b/TODO.md similarity index 100% rename from TODO rename to TODO.md From 02fafca0ef163964b8696340d609fca9bbfbfb02 Mon Sep 17 00:00:00 2001 From: Doug Fritz Date: Thu, 4 Sep 2014 16:53:27 -0700 Subject: [PATCH 7/9] update linting --- .jscsrc | 1 + gulpfile.js | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.jscsrc b/.jscsrc index 0a13d61..620345b 100644 --- a/.jscsrc +++ b/.jscsrc @@ -10,6 +10,7 @@ "disallowKeywords": ["with"], "disallowSpacesInsideObjectBrackets": null, "disallowImplicitTypeConversion": ["string"], + "disallowMultipleVarDecl": null, "safeContextKeyword": "_this", diff --git a/gulpfile.js b/gulpfile.js index 9440aa4..13f57d1 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -7,7 +7,7 @@ var gulp = require('gulp'), browserSync = require('browser-sync'), reload = browserSync.reload; -gulp.task('default', ['docs', 'build']); +gulp.task('default', ['docs', 'build']) gulp.task('watch', ['default'], function() { @@ -54,14 +54,16 @@ gulp.task('jscs', function() { .pipe($.jscs()); }); -gulp.task('lint', function() { +gulp.task('jshint', function() { return gulp.src('elements/**/*.js') .pipe(reload({stream: true, once: true})) - .pipe($.jshint()) + .pipe($.jshint('.jshintrc')) .pipe($.jshint.reporter('jshint-stylish')) .pipe($.if(!browserSync.active, $.jshint.reporter('fail'))); }); +gulp.task('lint', ['jscs', 'jshint']); + gulp.task('css', function() { return css('elements/**/*.styl', 'elements'); From fff108a63f894a33f03c52f4e3c0577234ca8974 Mon Sep 17 00:00:00 2001 From: Doug Fritz Date: Thu, 4 Sep 2014 17:33:25 -0700 Subject: [PATCH 8/9] jshint browser so things like document do not have to be declared as globals --- .jshintrc | 3 ++- elements/Gui.js | 2 -- elements/controller-number/controller-number.js | 2 +- elements/gui-panel/gui-panel.js | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.jshintrc b/.jshintrc index 1419d9f..0b99fb8 100644 --- a/.jshintrc +++ b/.jshintrc @@ -9,5 +9,6 @@ "noarg": true, "undef": true, "unused": "vars", - "strict": true + "strict": true, + "browser": true } diff --git a/elements/Gui.js b/elements/Gui.js index 24d30f6..a8bda49 100644 --- a/elements/Gui.js +++ b/elements/Gui.js @@ -1,5 +1,3 @@ -/* globals document */ - (function(scope) { 'use strict'; diff --git a/elements/controller-number/controller-number.js b/elements/controller-number/controller-number.js index 28e5c94..f678c81 100644 --- a/elements/controller-number/controller-number.js +++ b/elements/controller-number/controller-number.js @@ -1,4 +1,4 @@ -/* globals Gui, Polymer, window */ +/* globals Gui, Polymer */ 'use strict'; /* diff --git a/elements/gui-panel/gui-panel.js b/elements/gui-panel/gui-panel.js index c285fed..e70caca 100644 --- a/elements/gui-panel/gui-panel.js +++ b/elements/gui-panel/gui-panel.js @@ -1,4 +1,4 @@ -/* globals Polymer, window, document, Path, Gui */ +/* globals Polymer, Path, Gui */ 'use strict'; // [ ] scrolling when docked From 58f74b13196bfe36d2686a9b9ef740c0252d9bc0 Mon Sep 17 00:00:00 2001 From: Doug Fritz Date: Thu, 4 Sep 2014 17:36:15 -0700 Subject: [PATCH 9/9] add missing import --- gulpfile.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gulpfile.js b/gulpfile.js index 13f57d1..05b87ac 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -33,7 +33,7 @@ gulp.task('build', ['vulcanize'], function() { .pipe($.replace(/'/g, '\\\'')) .pipe($.replace(/^(.*)$/gm, '\'$1\',')) .pipe($.insert.wrap('document.write([', '].join("\\n"))')) - .pipe(rename('gui.js')) + .pipe($.rename('gui.js')) .pipe(gulp.dest('build')); });