Permalink
Browse files

App: Use bower to fetch external dependencies

Fixes #228
Closes #229
  • Loading branch information...
1 parent 6f2f03e commit bd65c703124fadc58118927f2bc2fc3d7a09266c @rxaviers rxaviers committed Jun 7, 2014
View
@@ -0,0 +1,3 @@
+{
+ "directory": "external"
+}
View
@@ -51,18 +51,22 @@ grunt.initConfig({
}
},
copy: {
- appExternal: {
- expand: true,
- cwd: "external",
- src: [ "farbtastic.css", "lzma_worker.min.js" ],
- dest: "app/dist/external"
+ appExternalFarbtastic: {
+ src: "external/farbtastic/farbtastic.css",
+ dest: "app/dist/external/farbtastic.css"
},
appImages: {
expand: true,
cwd: "app/src",
src: [ "images/**/*" ],
dest: "app/dist"
},
+ appImagesExternalFarbtastic: {
+ expand: true,
+ cwd: "external/farbtastic",
+ src: [ "marker.png", "mask.png", "wheel.png" ],
+ dest: "app/dist/images/farbtastic"
+ },
appStyles: {
expand: true,
cwd: "app/src",
@@ -76,13 +80,17 @@ grunt.initConfig({
},
// DownloadBuilder minified frontend bundle
download: {
- src: [ "external/event_emitter.min.js", "external/handlebars.runtime.js", "tmp/app/template/download.js", "external/lzma.js", "app/src/hash.js", "app/src/querystring.js", "app/src/model.js", "app/src/download.js" ],
+ src: [ "external/eventEmitter/EventEmitter.js", "external/handlebars/handlebars.runtime.js", "tmp/app/template/download.js", "external/lzma-js/src/lzma.js", "app/src/hash.js", "app/src/querystring.js", "app/src/model.js", "app/src/download.js" ],
dest: "app/dist/download.all.min.js"
},
// ThemeRoller minified frontend bundle
themeroller: {
- src: [ "external/event_emitter.min.js", "external/handlebars.runtime.js", "tmp/app/template/themeroller.js", "external/farbtastic.js", "external/lzma.js", "app/src/hash.js", "app/src/querystring.js", "app/src/model.js", "app/src/themeroller.js" ],
+ src: [ "external/eventEmitter/EventEmitter.js", "external/handlebars/handlebars.runtime.js", "tmp/app/template/themeroller.js", "external/farbtastic/farbtastic.js", "external/lzma-js/src/lzma.js", "app/src/hash.js", "app/src/querystring.js", "app/src/model.js", "app/src/themeroller.js" ],
dest: "app/dist/themeroller.all.min.js"
+ },
+ external_lzma_worker: {
+ src: [ "external/lzma-js/src/lzma_worker.js" ],
+ dest: "app/dist/external/lzma_worker.min.js"
}
},
clean: {
@@ -454,7 +462,15 @@ function buildPackages( folder, callback ) {
grunt.registerTask( "default", [ "check-modules", "jshint" ] );
-grunt.registerTask( "build-app", [ "clean", "handlebars", "copy", "uglify" ] );
+grunt.registerTask( "bower-install", "Runs bower install", function() {
+ var done = this.async();
+ grunt.util.spawn({
+ cmd: "./node_modules/bower/bin/bower",
+ args: [ "install" ]
+ }, done );
+});
+
+grunt.registerTask( "build-app", [ "clean", "bower-install", "handlebars", "copy", "uglify" ] );
grunt.registerTask( "build-packages", "Builds zip package of each jQuery UI release specified in config file with all components and lightness theme, inside the given folder", function( folder ) {
var done = this.async();
Deleted file not rendered
Deleted file not rendered
Deleted file not rendered
View
@@ -9,7 +9,7 @@
* http://jquery.org/license
*/
(function( $, Hash, JST, Model, QueryString, undefined ) {
- var model, reloadRollYourOwn, skipHashChange, theme, Theme,
+ var farbtasticTriggerChangeDelay, model, reloadRollYourOwn, skipHashChange, theme, Theme,
focusedEl = null,
openGroups = [],
textureVars = "bgTextureDefault bgTextureHover bgTextureActive bgTextureHeader bgTextureContent bgTextureHighlight bgTextureError bgTextureOverlay bgTextureShadow".split( " " ),
@@ -60,6 +60,53 @@
model.set( QueryString.decode( themeroller.find( ".application form" ).serialize() ) );
}
+ // Farbtastic hack.
+ // TODO: get rid of this hack.
+ farbtasticTriggerChangeDelay = 200;
+ function updateDisplay( fb, e ) {
+ return function() {
+ // Markers
+ var angle = fb.hsl[ 0 ] * 6.28;
+ $( ".h-marker", e ).css({
+ left: Math.round( Math.sin( angle ) * fb.radius + fb.width / 2 ) + "px",
+ top: Math.round( -Math.cos( angle ) * fb.radius + fb.width / 2 ) + "px"
+ });
+
+ $( ".sl-marker", e ).css({
+ left: Math.round( fb.square * ( 0.5 - fb.hsl[ 1 ] ) + fb.width / 2 ) + "px",
+ top: Math.round( fb.square * ( 0.5 - fb.hsl[ 2 ] ) + fb.width / 2 ) + "px"
+ });
+
+ // Saturation/Luminance gradient
+ $( ".color", e ).css( "backgroundColor", fb.pack( fb.HSLToRGB( [ fb.hsl[ 0 ], 1, 0.5 ] ) ) );
+
+ // Linked elements or callback
+ if ( typeof fb.callback === "object" ) {
+ // Set background/foreground color
+ $( fb.callback ).css({
+ backgroundColor: fb.color,
+ color: fb.hsl[ 2 ] > 0.5 ? "#000" : "#fff"
+ });
+
+ // Change linked value
+ $( fb.callback ).each(function() {
+ if ( this.value && this.value !== fb.color ) {
+ var element = $( this );
+ element.val( fb.color );
+ if( fb.triggerChange ) {
+ clearInterval( fb.triggerChange );
+ }
+ fb.triggerChange = setTimeout(function() {
+ element.trigger( "change" );
+ }, farbtasticTriggerChangeDelay);
+ }
+ });
+ } else if ( typeof fb.callback === "function" ) {
+ fb.callback.call( fb, fb.color );
+ }
+ };
+ }
+
// Set up spindowns
$.fn.spinDown = function() {
return this.on( "click", function( event ) {
@@ -162,12 +209,20 @@
$( this ).trigger( "validate" );
},
"click": function( event ) {
+
+ // TODO: do we need the `#picker` id?
+ var farbtastic,
+ picker = $( "<div id=\"picker\"></div>" );
$( this ).addClass( "focus" );
$( "#picker" ).remove();
themeroller.find( "div.picker-on" ).removeClass( "picker-on" );
themeroller.find( "div.texturePicker ul:visible" ).hide( 0 ).parent().css( "position", "static" );
- $( this ).after( "<div id=\"picker\"></div>" ).parent().addClass( "picker-on" );
- $( "#picker" ).farbtastic( this );
+ $( this ).after( picker ).parent().addClass( "picker-on" );
+
+ // Farbtastic hack.
+ // TODO: get rid of this hack.
+ farbtastic = $.farbtastic( picker, this );
+ farbtastic.updateDisplay = updateDisplay( farbtastic, picker.find( ".farbtastic" ) );
event.preventDefault();
},
"validate": function() {
View
@@ -0,0 +1,10 @@
+{
+ "name": "download.jqueryui.com",
+ "dependencies": {},
+ "devDependencies": {
+ "eventEmitter": "4.2.7",
+ "farbtastic": "1.3u",
+ "handlebars": "1.3.0",
+ "lzma-js": "nmrugg/LZMA-JS#27986c2cb045bc1c5b0be5a0b8f234cff7364e41"
+ }
+}
View
@@ -65,7 +65,7 @@ Frontend.prototype = {
categories: JqueryUi.getStable().categories()
}),
host: this.host,
- lzmaWorker: ( production ? "/resources" : "" ) + "/external/lzma_worker.min.js",
+ lzmaWorker: production ? "/resources/external/lzma_worker.min.js" : "/external/lzma-js/src/lzma_worker.js",
production: production,
resources: this.resources,
jqueryUis: jqueryUis

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -1,33 +0,0 @@
-.farbtastic {
- position: relative;
-}
-.farbtastic * {
- position: absolute;
- cursor: crosshair;
-}
-.farbtastic, .farbtastic .wheel {
- width: 195px;
- height: 195px;
-}
-.farbtastic .color, .farbtastic .overlay {
- top: 47px;
- left: 47px;
- width: 101px;
- height: 101px;
-}
-.farbtastic .wheel {
- background: url("wheel.png") no-repeat;
- width: 195px;
- height: 195px;
-}
-.farbtastic .overlay {
- background: url("mask.png") no-repeat;
-}
-.farbtastic .marker {
- width: 17px;
- height: 17px;
- margin: -8px 0 0 -8px;
- overflow: hidden;
- background: url("marker.png") no-repeat;
-}
-
Oops, something went wrong.

0 comments on commit bd65c70

Please sign in to comment.