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
|
||||
},
|
||||
|
||||
"requireSpacesInsideParentheses": "allButNested",
|
||||
"requireSpacesInsideObjectBrackets": "allButNested",
|
||||
"requireSpacesInsideArrayBrackets": "allButNested",
|
||||
"requireSpacesInsideParentheses": "all",
|
||||
"requireSpacesInsideObjectBrackets": "all",
|
||||
"requireSpacesInsideArrayBrackets": "all",
|
||||
|
||||
"requireParenthesesAroundIIFE": true,
|
||||
|
||||
|
@ -9,6 +9,6 @@
|
||||
"noarg": true,
|
||||
"undef": true,
|
||||
"unused": "vars",
|
||||
"strict": true,
|
||||
"strict": false,
|
||||
"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 ) {
|
||||
|
||||
ready ? fnc() : readyHandlers.push( fnc );
|
||||
if ( ready ) {
|
||||
fnc();
|
||||
} else {
|
||||
readyHandlers.push( fnc );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
@ -24,14 +24,14 @@ Polymer( 'controller-base', {
|
||||
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();
|
||||
this.fire( 'change', this.value );
|
||||
this.update();
|
||||
|
||||
},
|
||||
|
||||
|
@ -203,7 +203,7 @@ Polymer( 'controller-number', {
|
||||
|
||||
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 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++ ) {
|
||||
if ( str.charAt( i ) !== '0' ) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* globals Polymer, Object, Array */
|
||||
'use strict';
|
||||
|
||||
|
||||
Polymer( 'controller-option', {
|
||||
|
||||
|
@ -24,80 +24,80 @@ spacing = ( ( ( size - ph*2 ) - stroke * 3 ) / 2 )
|
||||
xlen = 11px
|
||||
|
||||
#container
|
||||
// font-size 0
|
||||
// border: 1px solid blue
|
||||
height: 100%
|
||||
cursor: pointer
|
||||
|
||||
// font-size 0
|
||||
// border: 1px solid blue
|
||||
height: 100%
|
||||
cursor: pointer
|
||||
|
||||
#button
|
||||
width size
|
||||
height size
|
||||
box-sizing border-box
|
||||
border-radius border-radius
|
||||
padding ph pw
|
||||
position relative
|
||||
background bg
|
||||
margin 0 auto
|
||||
width size
|
||||
height size
|
||||
box-sizing border-box
|
||||
border-radius border-radius
|
||||
padding ph pw
|
||||
position relative
|
||||
background bg
|
||||
margin 0 auto
|
||||
|
||||
&.open-true
|
||||
&.open-true
|
||||
|
||||
.one
|
||||
transform translate3d(4px, 0, 0) rotate(45deg) translate3d(3.5px, 0, 0)
|
||||
width xlen
|
||||
.one
|
||||
transform translate3d(4px, 0, 0) rotate(45deg) translate3d(3.5px, 0, 0)
|
||||
width xlen
|
||||
|
||||
.three
|
||||
transform translate3d(4px, 0, 0) rotate(-45deg) translate3d(3.5px, 0, 0)
|
||||
width xlen
|
||||
.three
|
||||
transform translate3d(4px, 0, 0) rotate(-45deg) translate3d(3.5px, 0, 0)
|
||||
width xlen
|
||||
|
||||
.two
|
||||
width 0
|
||||
.two
|
||||
width 0
|
||||
|
||||
.slider
|
||||
&:before
|
||||
width 0
|
||||
height 0
|
||||
.slider
|
||||
&:before
|
||||
width 0
|
||||
height 0
|
||||
|
||||
.slider
|
||||
width size - pw * 2
|
||||
border-radius stroke * 2
|
||||
height stroke
|
||||
background fg
|
||||
position absolute
|
||||
transform-origin stroke * 0.5 stroke * 0.5
|
||||
transition all dur delay ease
|
||||
|
||||
&:before
|
||||
width knob
|
||||
height knob
|
||||
margin-top -( ( knob - stroke ) / 2 )
|
||||
margin-left -( ( knob ) / 2 )
|
||||
border-radius knob
|
||||
width size - pw * 2
|
||||
border-radius stroke * 2
|
||||
height stroke
|
||||
background fg
|
||||
display inline-block
|
||||
content ' '
|
||||
position absolute
|
||||
left l
|
||||
transition left knob-dur cubic-bezier(0, 0.5, 0, 1), width 0.001s delay, height 0.001s delay
|
||||
|
||||
// #container:hover &
|
||||
// left r
|
||||
transform-origin stroke * 0.5 stroke * 0.5
|
||||
transition all dur delay ease
|
||||
|
||||
&.two
|
||||
margin-top spacing + stroke
|
||||
|
||||
&:before
|
||||
left r
|
||||
transition-delay: stagger, delay, delay
|
||||
|
||||
// #container:hover &
|
||||
// left l
|
||||
width knob
|
||||
height knob
|
||||
margin-top -( ( knob - stroke ) / 2 )
|
||||
margin-left -( ( knob ) / 2 )
|
||||
border-radius knob
|
||||
background fg
|
||||
display inline-block
|
||||
content ' '
|
||||
position absolute
|
||||
left l
|
||||
transition left knob-dur cubic-bezier(0, 0.5, 0, 1), width 0.001s delay, height 0.001s delay
|
||||
|
||||
// #container:hover &
|
||||
// left r
|
||||
|
||||
&.three
|
||||
margin-top spacing * 2 + stroke * 2
|
||||
|
||||
&:before
|
||||
left l
|
||||
transition-delay: stagger * 2, delay, delay
|
||||
|
||||
// #container:hover &
|
||||
// left r
|
||||
&.two
|
||||
margin-top spacing + stroke
|
||||
|
||||
&:before
|
||||
left r
|
||||
transition-delay: stagger, delay, delay
|
||||
|
||||
// #container:hover &
|
||||
// left l
|
||||
|
||||
&.three
|
||||
margin-top spacing * 2 + stroke * 2
|
||||
|
||||
&:before
|
||||
left l
|
||||
transition-delay: stagger * 2, delay, delay
|
||||
|
||||
// #container:hover &
|
||||
// left r
|
||||
|
@ -47,8 +47,7 @@ Polymer( 'gui-panel', {
|
||||
var value = Path.get( path ).getValueFrom( object );
|
||||
|
||||
if ( value === null || value === undefined ) {
|
||||
return Gui.error( object +
|
||||
' doesn\'t have a value for path "' + path + '".' );
|
||||
return Gui.error( object + ' doesn\'t have a value for path "' + path + '".' );
|
||||
}
|
||||
|
||||
var args = Array.prototype.slice.call( arguments, 2 );
|
||||
@ -135,8 +134,7 @@ Polymer( 'gui-panel', {
|
||||
|
||||
listenAll: function() {
|
||||
|
||||
Gui.warn( 'controller.listenAll() is deprecated. ' +
|
||||
'All controllers are listened for free.' );
|
||||
Gui.warn( 'controller.listenAll() is deprecated. All controllers are listened for free.' );
|
||||
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* globals Polymer */
|
||||
|
||||
'use strict';
|
||||
|
||||
Polymer( 'gui-row', {
|
||||
|
||||
|
75
gulpfile.js
75
gulpfile.js
@ -1,66 +1,73 @@
|
||||
var gulp = require( 'gulp' ),
|
||||
$ = require( 'gulp-load-plugins' )(),
|
||||
nib = require( 'nib' ),
|
||||
fs = require( 'fs' ),
|
||||
marked = require( 'marked' ),
|
||||
karma = require( 'karma' ),
|
||||
'use strict';
|
||||
|
||||
var gulp = require( 'gulp' ),
|
||||
nib = require( 'nib' ),
|
||||
fs = require( 'fs' ),
|
||||
marked = require( 'marked' ),
|
||||
karma = require( 'karma' ),
|
||||
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( {
|
||||
frameworks: [ 'jasmine' ],
|
||||
files: [
|
||||
'build/gui.js',
|
||||
'tests/*.js'
|
||||
]
|
||||
files: paths.test
|
||||
} );
|
||||
|
||||
gulp.watch( ['elements/**/*.styl', 'elements/**/*.html', 'elements/**/*.js', 'gui.html'], ['build'] );
|
||||
|
||||
gulp.watch( ['README.md', 'docs/*'], ['docs'] );
|
||||
gulp.watch( paths.docs, [ 'docs' ] );
|
||||
gulp.watch( paths.lint, [ 'lint' ] );
|
||||
gulp.watch( paths.build, [ 'build' ] );
|
||||
|
||||
} );
|
||||
|
||||
gulp.task( 'build', ['vulcanize'], function() {
|
||||
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' ) );
|
||||
.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() {
|
||||
gulp.task( 'vulcanize', [ 'css' ], function() {
|
||||
|
||||
return gulp.src( 'gui.html' )
|
||||
.pipe( $.vulcanize( {
|
||||
dest: 'build',
|
||||
inline: true,
|
||||
strip: true
|
||||
|
||||
dest: 'build',
|
||||
inline: true,
|
||||
strip: true
|
||||
} ) );
|
||||
|
||||
} );
|
||||
|
||||
gulp.task( 'lint', ['jscs', 'jshint'] );
|
||||
gulp.task( 'lint', [ 'jscs', 'jshint' ] );
|
||||
|
||||
gulp.task( 'jscs', function() {
|
||||
|
||||
return gulp.src( 'elements/**/*.js', '*.json', '*.js' )
|
||||
.pipe( $.jscs() );
|
||||
return gulp.src( paths.lint )
|
||||
.pipe( $.jscs() );
|
||||
|
||||
} );
|
||||
|
||||
gulp.task( 'jshint', function() {
|
||||
|
||||
return gulp.src( 'elements/**/*.js', '*.json', '*.js' )
|
||||
return gulp.src( paths.lint )
|
||||
.pipe( reload( { stream: true, once: true } ) )
|
||||
.pipe( $.jshint( '.jshintrc' ) )
|
||||
.pipe( $.jshint.reporter( 'jshint-stylish' ) )
|
||||
@ -92,7 +99,7 @@ gulp.task( 'docs', function() {
|
||||
|
||||
gulp.task( 'clean', function() {
|
||||
|
||||
return gulp.src( ['build/*', '**/*.css'] )
|
||||
return gulp.src( paths.clean )
|
||||
.pipe( $.rimraf() );
|
||||
|
||||
} );
|
||||
@ -100,7 +107,7 @@ gulp.task( 'clean', function() {
|
||||
function css( src, dest ) {
|
||||
|
||||
return gulp.src( src )
|
||||
.pipe( $.stylus( { use: [nib()] } ) )
|
||||
.pipe( $.stylus( { use: [ nib() ] } ) )
|
||||
.pipe( gulp.dest( dest ) );
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user