mirror of
https://github.com/dataarts/dat.gui.git
synced 2024-12-12 04:08:27 +00:00
style
This commit is contained in:
parent
a746f0e29b
commit
8b13c1b403
6
.jscsrc
6
.jscsrc
@ -28,9 +28,9 @@
|
|||||||
"beforeAlternate": true
|
"beforeAlternate": true
|
||||||
},
|
},
|
||||||
|
|
||||||
"requireSpacesInsideParentheses": "allButNested",
|
"requireSpacesInsideParentheses": "all",
|
||||||
"requireSpacesInsideObjectBrackets": "allButNested",
|
"requireSpacesInsideObjectBrackets": "all",
|
||||||
"requireSpacesInsideArrayBrackets": "allButNested",
|
"requireSpacesInsideArrayBrackets": "all",
|
||||||
|
|
||||||
"requireParenthesesAroundIIFE": true,
|
"requireParenthesesAroundIIFE": true,
|
||||||
|
|
||||||
|
@ -9,6 +9,6 @@
|
|||||||
"noarg": true,
|
"noarg": true,
|
||||||
"undef": true,
|
"undef": true,
|
||||||
"unused": "vars",
|
"unused": "vars",
|
||||||
"strict": true,
|
"strict": false,
|
||||||
"browser": true
|
"browser": true
|
||||||
}
|
}
|
||||||
|
File diff suppressed because one or more lines are too long
10
build/gui.js
10
build/gui.js
File diff suppressed because one or more lines are too long
@ -74,7 +74,11 @@
|
|||||||
|
|
||||||
Gui.ready = function( fnc ) {
|
Gui.ready = function( fnc ) {
|
||||||
|
|
||||||
ready ? fnc() : readyHandlers.push( fnc );
|
if ( ready ) {
|
||||||
|
fnc();
|
||||||
|
} else {
|
||||||
|
readyHandlers.push( fnc );
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -24,14 +24,14 @@ Polymer( 'controller-base', {
|
|||||||
this.object = object;
|
this.object = object;
|
||||||
this.path = path;
|
this.path = path;
|
||||||
|
|
||||||
this.bind( 'value', new PathObserver( this.object, this.path ));
|
this.bind( 'value', new PathObserver( this.object, this.path ) );
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
valueChanged: function() {
|
valueChanged: function() {
|
||||||
|
|
||||||
this.update();
|
|
||||||
this.fire( 'change', this.value );
|
this.fire( 'change', this.value );
|
||||||
|
this.update();
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -203,7 +203,7 @@ Polymer( 'controller-number', {
|
|||||||
|
|
||||||
tracky: function( e ) {
|
tracky: function( e ) {
|
||||||
|
|
||||||
this._dragFriction = Math.max( 0.01, Math.min( 1, this.map( e.dy, 50, 300, 1, 0.1 )) );
|
this._dragFriction = Math.max( 0.01, Math.min( 1, this.map( e.dy, 50, 300, 1, 0.1 ) ) );
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -240,7 +240,7 @@ Polymer( 'controller-number', {
|
|||||||
var str = v.toString();
|
var str = v.toString();
|
||||||
var numDecimals = str.substring( str.indexOf( '.' ) + 1 ).length;
|
var numDecimals = str.substring( str.indexOf( '.' ) + 1 ).length;
|
||||||
|
|
||||||
str = v.toFixed( Math.min( numDecimals, this.decimals ));
|
str = v.toFixed( Math.min( numDecimals, this.decimals ) );
|
||||||
|
|
||||||
for ( var z, i = 0, l = str.length; i < l; i++ ) {
|
for ( var z, i = 0, l = str.length; i < l; i++ ) {
|
||||||
if ( str.charAt( i ) !== '0' ) {
|
if ( str.charAt( i ) !== '0' ) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* globals Polymer, Object, Array */
|
/* globals Polymer, Object, Array */
|
||||||
'use strict';
|
|
||||||
|
|
||||||
Polymer( 'controller-option', {
|
Polymer( 'controller-option', {
|
||||||
|
|
||||||
|
@ -47,8 +47,7 @@ Polymer( 'gui-panel', {
|
|||||||
var value = Path.get( path ).getValueFrom( object );
|
var value = Path.get( path ).getValueFrom( object );
|
||||||
|
|
||||||
if ( value === null || value === undefined ) {
|
if ( value === null || value === undefined ) {
|
||||||
return Gui.error( object +
|
return Gui.error( object + ' doesn\'t have a value for path "' + path + '".' );
|
||||||
' doesn\'t have a value for path "' + path + '".' );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var args = Array.prototype.slice.call( arguments, 2 );
|
var args = Array.prototype.slice.call( arguments, 2 );
|
||||||
@ -135,8 +134,7 @@ Polymer( 'gui-panel', {
|
|||||||
|
|
||||||
listenAll: function() {
|
listenAll: function() {
|
||||||
|
|
||||||
Gui.warn( 'controller.listenAll() is deprecated. ' +
|
Gui.warn( 'controller.listenAll() is deprecated. All controllers are listened for free.' );
|
||||||
'All controllers are listened for free.' );
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* globals Polymer */
|
/* globals Polymer */
|
||||||
|
'use strict';
|
||||||
|
|
||||||
Polymer( 'gui-row', {
|
Polymer( 'gui-row', {
|
||||||
|
|
||||||
|
47
gulpfile.js
47
gulpfile.js
@ -1,66 +1,73 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
var gulp = require( 'gulp' ),
|
var gulp = require( 'gulp' ),
|
||||||
$ = require( 'gulp-load-plugins' )(),
|
|
||||||
nib = require( 'nib' ),
|
nib = require( 'nib' ),
|
||||||
fs = require( 'fs' ),
|
fs = require( 'fs' ),
|
||||||
marked = require( 'marked' ),
|
marked = require( 'marked' ),
|
||||||
karma = require( 'karma' ),
|
karma = require( 'karma' ),
|
||||||
browserSync = require( 'browser-sync' ),
|
browserSync = require( 'browser-sync' ),
|
||||||
reload = browserSync.reload;
|
reload = browserSync.reload,
|
||||||
|
$ = require( 'gulp-load-plugins' )();
|
||||||
|
|
||||||
gulp.task( 'default', ['docs', 'build'] )
|
|
||||||
|
|
||||||
gulp.task( 'watch', ['default'], function() {
|
var paths = {
|
||||||
|
build: [ 'elements/**/*.styl', 'elements/**/*.html', 'elements/**/*.js' , 'gui.html' ],
|
||||||
|
lint: [ 'gulpfile.js', 'elements/**/*.js' ],
|
||||||
|
test: [ 'build/gui.js', 'tests/*.js' ],
|
||||||
|
clean: [ 'build/*', '**/*.css' ],
|
||||||
|
docs: [ 'README.md', 'docs/*' ]
|
||||||
|
};
|
||||||
|
|
||||||
|
gulp.task( 'default', [ 'docs', 'lint', 'build' ] );
|
||||||
|
|
||||||
|
gulp.task( 'watch', [ 'default' ], function() {
|
||||||
|
|
||||||
karma.server.start( {
|
karma.server.start( {
|
||||||
frameworks: [ 'jasmine' ],
|
frameworks: [ 'jasmine' ],
|
||||||
files: [
|
files: paths.test
|
||||||
'build/gui.js',
|
|
||||||
'tests/*.js'
|
|
||||||
]
|
|
||||||
} );
|
} );
|
||||||
|
|
||||||
gulp.watch( ['elements/**/*.styl', 'elements/**/*.html', 'elements/**/*.js', 'gui.html'], ['build'] );
|
gulp.watch( paths.docs, [ 'docs' ] );
|
||||||
|
gulp.watch( paths.lint, [ 'lint' ] );
|
||||||
gulp.watch( ['README.md', 'docs/*'], ['docs'] );
|
gulp.watch( paths.build, [ 'build' ] );
|
||||||
|
|
||||||
} );
|
} );
|
||||||
|
|
||||||
gulp.task( 'build', ['vulcanize'], function() {
|
gulp.task( 'build', [ 'vulcanize' ], function() {
|
||||||
|
|
||||||
return gulp.src( 'build/gui.html' )
|
return gulp.src( 'build/gui.html' )
|
||||||
.pipe( $.replace( /\\/g, '\\\\' ) )
|
.pipe( $.replace( /\\/g, '\\\\' ) )
|
||||||
.pipe( $.replace( /'/g, '\\\'' ) )
|
.pipe( $.replace( /'/g, '\\\'' ) )
|
||||||
.pipe( $.replace( /^(.*)$/gm, '\'$1\',' ) )
|
.pipe( $.replace( /^(.*)$/gm, '\'$1\',' ) )
|
||||||
.pipe( $.insert.wrap( 'document.write( [', '].join( "\\n" ) )' ) )
|
.pipe( $.insert.wrap( 'document.write([', '].join("\\n"))' ) )
|
||||||
.pipe( $.rename( 'gui.js' ) )
|
.pipe( $.rename( 'gui.js' ) )
|
||||||
.pipe( gulp.dest( 'build' ) );
|
.pipe( gulp.dest( 'build' ) );
|
||||||
|
|
||||||
} );
|
} );
|
||||||
|
|
||||||
gulp.task( 'vulcanize', ['css'], function() {
|
gulp.task( 'vulcanize', [ 'css' ], function() {
|
||||||
|
|
||||||
return gulp.src( 'gui.html' )
|
return gulp.src( 'gui.html' )
|
||||||
.pipe( $.vulcanize( {
|
.pipe( $.vulcanize( {
|
||||||
dest: 'build',
|
dest: 'build',
|
||||||
inline: true,
|
inline: true,
|
||||||
strip: true
|
strip: true
|
||||||
|
|
||||||
} ) );
|
} ) );
|
||||||
|
|
||||||
} );
|
} );
|
||||||
|
|
||||||
gulp.task( 'lint', ['jscs', 'jshint'] );
|
gulp.task( 'lint', [ 'jscs', 'jshint' ] );
|
||||||
|
|
||||||
gulp.task( 'jscs', function() {
|
gulp.task( 'jscs', function() {
|
||||||
|
|
||||||
return gulp.src( 'elements/**/*.js', '*.json', '*.js' )
|
return gulp.src( paths.lint )
|
||||||
.pipe( $.jscs() );
|
.pipe( $.jscs() );
|
||||||
|
|
||||||
} );
|
} );
|
||||||
|
|
||||||
gulp.task( 'jshint', function() {
|
gulp.task( 'jshint', function() {
|
||||||
|
|
||||||
return gulp.src( 'elements/**/*.js', '*.json', '*.js' )
|
return gulp.src( paths.lint )
|
||||||
.pipe( reload( { stream: true, once: true } ) )
|
.pipe( reload( { stream: true, once: true } ) )
|
||||||
.pipe( $.jshint( '.jshintrc' ) )
|
.pipe( $.jshint( '.jshintrc' ) )
|
||||||
.pipe( $.jshint.reporter( 'jshint-stylish' ) )
|
.pipe( $.jshint.reporter( 'jshint-stylish' ) )
|
||||||
@ -92,7 +99,7 @@ gulp.task( 'docs', function() {
|
|||||||
|
|
||||||
gulp.task( 'clean', function() {
|
gulp.task( 'clean', function() {
|
||||||
|
|
||||||
return gulp.src( ['build/*', '**/*.css'] )
|
return gulp.src( paths.clean )
|
||||||
.pipe( $.rimraf() );
|
.pipe( $.rimraf() );
|
||||||
|
|
||||||
} );
|
} );
|
||||||
@ -100,7 +107,7 @@ gulp.task( 'clean', function() {
|
|||||||
function css( src, dest ) {
|
function css( src, dest ) {
|
||||||
|
|
||||||
return gulp.src( src )
|
return gulp.src( src )
|
||||||
.pipe( $.stylus( { use: [nib()] } ) )
|
.pipe( $.stylus( { use: [ nib() ] } ) )
|
||||||
.pipe( gulp.dest( dest ) );
|
.pipe( gulp.dest( dest ) );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user