Skip to content
Browse files

Bump version

  • Loading branch information...
1 parent a5dcbfc commit a5c540cb6993b5be750754cd095b455cd626eaf4 @bebraw committed Sep 24, 2013
Showing with 6 additions and 6 deletions.
  1. +4 −4 dist/colorjoe.js
  2. +1 −1 dist/colorjoe.min.js
  3. +1 −1 package.json
View
8 dist/colorjoe.js
@@ -9,8 +9,8 @@
root.colorjoe = factory(root.one.color);
}
}(this, function(onecolor) {
-/*! colorjoe - v0.9.1 - Juho Vepsalainen <bebraw@gmail.com> - MIT
-https://bebraw.github.com/colorjoe - 2013-07-18 */
+/*! colorjoe - v0.9.2 - Juho Vepsalainen <bebraw@gmail.com> - MIT
+https://bebraw.github.com/colorjoe - 2013-09-24 */
/*! dragjs - v0.4.0 - Juho Vepsalainen <bebraw@gmail.com> - MIT
https://bebraw.github.com/dragjs - 2013-07-17 */
var drag = (function() {
@@ -696,7 +696,7 @@ function setup(o) {
}
function getColor(c) {
- if(!isDefined(c)) return onecolor('black');
+ if(!isDefined(c)) return onecolor('#000');
if(c.isColor) return c;
var ret = onecolor(c);
@@ -705,7 +705,7 @@ function getColor(c) {
if(isDefined(c)) console.warn('Passed invalid color to colorjoe, using black instead');
- return onecolor('black');
+ return onecolor('#000');
}
function setupExtras(p, joe, extras) {
View
2 dist/colorjoe.min.js
@@ -1 +1 @@
-!function(a,b){"object"==typeof exports?module.exports=b(require("onecolor")):"function"==typeof define&&define.amd?define(["onecolor"],b):a.colorjoe=b(a.one.color)}(this,function(a){function b(a,b,c){var d=document.createElement(a);return d.className=b,c.appendChild(d),d}function c(a){var b=Array.prototype.slice,c=b.apply(arguments,[1]);return function(){return a.apply(null,c.concat(b.apply(arguments)))}}function d(a,b,c,d){var g=D(a,c),h=e(b,g),i=f("text",g,d);return{label:h,input:i}}function e(a,c){var d=b("label","",c);return d.innerHTML=a,d}function f(a,c,d){var e=b("input","",c);return e.type=a,d&&(e.maxLength=d),e}function g(a,b){a.style.left=j(100*b,0,100)+"%"}function h(a,b){a.style.top=j(100*b,0,100)+"%"}function i(a,b){a.style.background=b}function j(a,b,c){return Math.min(Math.max(a,b),c)}function k(a){var b=E.div("currentColorContainer",a),c=E.div("currentColor",b);return{change:function(a){E.BG(c,a.cssa())}}}function l(a,b,c){function d(){var a=[e];l.forEach(function(b){a.push(b.e.input.value/f)}),j||a.push(b.getAlpha()),b.set(a)}var e=c.space,f=c.limit||255,g=c.fix>=0?c.fix:0,h=(""+f).length+g;h=g?h+1:h;var i=e.split(""),j="A"==e[e.length-1];if(e=j?e.slice(0,-1):e,["RGB","HSL","HSV","CMYK"].indexOf(e)<0)return console.warn("Invalid field names",e);var k=E.div("colorFields",a),l=i.map(function(a){a=a.toLowerCase();var b=E.labelInput("color "+a,a,k,h);return b.input.onkeyup=d,{name:a,e:b}});return{change:function(a){l.forEach(function(b){b.e.input.value=(a[b.name]()*f).toFixed(g)})}}}function m(a,b){function c(a){var c=E.clamp(a.y,0,1);E.Y(a.pointer,c),b.setAlpha(1-c)}var d=C.slider({parent:a,"class":"oned alpha",cbs:{begin:c,change:c}});return{change:function(a){E.Y(d.pointer,1-a.alpha())}}}function n(a,b,c){var d=E.labelInput("hex",c.label||"",a,7);return d.input.value="#",d.input.onkeyup=function(a){var c=a.keyCode||a.which,d=a.target.value;d="#"==d[0]?d:"#"+d,d=p(d,7,"0"),13==c&&b.set(d)},d.input.onblur=function(a){b.set(a.target.value)},{change:function(a){d.input.value="#"==d.input.value[0]?"#":"",d.input.value+=a.hex().slice(1)}}}function o(a,b,c){var d=E.e("a",c["class"]||"close",a);d.href="#",d.innerHTML=c.label||"Close",d.onclick=function(a){a.preventDefault(),b.hide()}}function p(a,b,c){for(var d=a,e=a.length;b>e;e++)d+=c;return d}function q(b,c){E.BG(b,new a.HSV(c,1,1).cssa())}function r(a){function b(a){k=g.xy(k,{x:E.clamp(a.x,0,1),y:E.clamp(a.y,0,1)},h,i),d()}function c(a){k=g.z(k,E.clamp(a.y,0,1),h,i),d()}function d(a){a=x(a)?a:[];for(var b,c=l.change,d=0,e=c.length;e>d;d++)b=c[d],-1==a.indexOf(b.name)&&b.fn(k)}function e(){if(!j.equals(k)){for(var a=0,b=l.done.length;b>a;a++)l.done[a].fn(k);j=k}}if(!a.e)return console.warn("colorjoe: missing element");var f=y(a.e)?document.getElementById(a.e):a.e;f.className="colorPicker";var g=a.cbs,h=C.xyslider({parent:f,"class":"twod",cbs:{begin:b,change:b,end:e}}),i=C.slider({parent:f,"class":"oned",cbs:{begin:c,change:c,end:e}}),j=s(a.color),k=g.init(j,h,i),l={change:[],done:[]},m={e:f,update:function(a){return d(a),this},hide:function(){return f.style.display="none",this},show:function(){return f.style.display="",this},get:function(){return k},set:function(a){var b=this.get();return k=g.init(s(a),h,i),b.equals(k)||this.update(),this},getAlpha:function(){return k.alpha()},setAlpha:function(a){return k=k.alpha(a),this.update(),this},on:function(a,b,c){return"change"==a||"done"==a?l[a].push({name:c,fn:b}):console.warn('Passed invalid evt name "'+a+'" to colorjoe.on'),this},removeAllListeners:function(a){if(a)delete l[a];else for(var b in l)delete l[b];return this}};return t(f,m,a.extras),d(),m}function s(b){if(!z(b))return a("black");if(b.isColor)return b;var c=a(b);return c?c:(z(b)&&console.warn("Passed invalid color to colorjoe, using black instead"),a("black"))}function t(a,b,c){if(c){var d,e,f,g=E.div("extras",a);c.forEach(function(a,c){if(x(a)?(e=a[0],f=a.length>1?a[1]:{}):(e=a,f={}),extra=e in G._extras?G._extras[e]:null){d=extra(g,u(b,e+c),f);for(var h in d)b.on(h,d[h],e)}})}}function u(a,b){var c=v(a);return c.update=function(){a.update([b])},c}function v(a){var b={};for(var c in a)b[c]=a[c];return b}function w(a,b){return b.map(a).filter(B).length==b.length}function x(a){return"[object Array]"===Object.prototype.toString.call(a)}function y(a){return"string"==typeof a}function z(a){return"undefined"!=typeof a}function A(a){return"function"==typeof a}function B(a){return a}var C=function(){function a(a,b){return a?(g()?h(a,b,"touchstart","touchmove","touchend"):h(a,b,"mousedown","mousemove","mouseup"),void 0):(console.warn("drag is missing elem!"),void 0)}function b(b){var c=e(b["class"]||"",b.parent),f=e("pointer",c);return e("shape shape1",f),e("shape shape2",f),e("bg bg1",c),e("bg bg2",c),a(c,d(b.cbs,f)),{background:c,pointer:f}}function c(b){var c=e(b["class"],b.parent),f=e("pointer",c);return e("shape",f),e("bg",c),a(c,d(b.cbs,f)),{background:c,pointer:f}}function d(a,b){function c(a){return function(c){c.pointer=b,a(c)}}var d={};for(var e in a)d[e]=c(a[e]);return d}function e(a,b){return f("div",a,b)}function f(a,b,c){var d=document.createElement(a);return b&&(d.className=b),c.appendChild(d),d}function g(){return"undefined"!=typeof window.ontouchstart}function h(a,b,c,d,e){var f=!1;b=k(b);var g=b.begin,h=b.change,l=b.end;i(a,c,function(b){function c(){f=!1,j(document,d,k),j(document,e,c),n(l,a,b)}f=!0;var k=o(n,h,a);i(document,d,k),i(document,e,c),n(g,a,b)})}function i(a,b,c){a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent&&a.attachEvent("on"+b,c)}function j(a,b,c){a.removeEventListener?a.removeEventListener(b,c,!1):a.detachEvent&&a.detachEvent("on"+b,c)}function k(a){if(a)return{begin:a.begin||m,change:a.change||m,end:a.end||m};var b,c;return{begin:function(a){b={x:a.elem.offsetLeft,y:a.elem.offsetTop},c=a.cursor},change:function(a){l(a.elem,"left",b.x+a.cursor.x-c.x+"px"),l(a.elem,"top",b.y+a.cursor.y-c.y+"px")},end:m}}function l(a,b,c){a.style[b]=c}function m(){}function n(a,b,c){c.preventDefault();var d=p(b),e=b.clientWidth,f=b.clientHeight,g={x:q(b,c),y:r(b,c)},h=(g.x-d.x)/e,i=(g.y-d.y)/f;a({x:isNaN(h)?0:h,y:isNaN(i)?0:i,cursor:g,elem:b,e:c})}function o(a){var b=Array.prototype.slice,c=b.apply(arguments,[1]);return function(){return a.apply(null,c.concat(b.apply(arguments)))}}function p(a){var b=0,c=0;if(a.offsetParent)do b+=a.offsetLeft,c+=a.offsetTop;while(a=a.offsetParent);return{x:b,y:c}}function q(a,b){if(t(a)){var c=parseInt(u(document.body,"marginLeft"),10)-s(a,"scrollLeft")+window.pageXOffset+a.style.marginLeft;return b.clientX-c}return b.pageX?b.pageX:b.clientX?b.clientX+document.body.scrollLeft:void 0}function r(a,b){if(t(a)){var c=parseInt(u(document.body,"marginTop"),10)-s(a,"scrollTop")+window.pageYOffset+a.style.marginTop;return b.clientY-c}return b.pageY?b.pageY:b.clientY?b.clientY+document.body.scrollTop:void 0}function s(a,b){for(var c=0;"HTML"!=a.nodeName;)c+=a[b],a=a.parentNode;return c}function t(a){for(;"HTML"!=a.nodeName&&"fixed"!=v(a,"position");)a=a.parentNode;return"HTML"==a.nodeName?!1:!0}function u(a,b){return a.currentStyle?a.currentStyle[b]:document.defaultView&&document.defaultView.getComputedStyle?document.defaultView.getComputedStyle(a,"")[b]:a.style[b]}function v(a,b){var c;return c=window.getComputedStyle?window.getComputedStyle(a,null):a.currentStyle,c[b]}return a.xyslider=b,a.slider=c,a}(),D=c(b,"div"),E={clamp:j,e:b,div:D,partial:c,labelInput:d,X:g,Y:h,BG:i},F={currentColor:k,fields:l,hex:n,alpha:m,close:o},G=function(a){return w(A,[a.init,a.xy,a.z])?function(b,c,d){return r({e:b,color:c,cbs:a,extras:d})}:console.warn("colorjoe: missing cb")};G.rgb=G({init:function(b,c,d){var e=a(b).hsl();return this.xy(e,{x:e.saturation(),y:1-e.value()},c,d),this.z(e,e.hue(),c,d),e},xy:function(a,b,c){return E.X(c.pointer,b.x),E.Y(c.pointer,b.y),a.saturation(b.x).value(1-b.y)},z:function(a,b,c,d){return E.Y(d.pointer,b),q(c.background,b),a.hue(b)}}),G.hsl=G({init:function(b,c,d){var e=a(b).hsl();return this.xy(e,{x:e.hue(),y:1-e.saturation()},c,d),this.z(e,1-e.lightness(),c,d),e},xy:function(a,b,c,d){return E.X(c.pointer,b.x),E.Y(c.pointer,b.y),q(d.background,b.x),a.hue(b.x).saturation(1-b.y)},z:function(a,b,c,d){return E.Y(d.pointer,b),a.lightness(1-b)}}),G._extras={},G.registerExtra=function(a,b){a in G._extras&&console.warn('Extra "'+a+'"has been registered already!'),G._extras[a]=b};for(var H in F)G.registerExtra(H,F[H]);return G});
+!function(a,b){"object"==typeof exports?module.exports=b(require("onecolor")):"function"==typeof define&&define.amd?define(["onecolor"],b):a.colorjoe=b(a.one.color)}(this,function(a){function b(a,b,c){var d=document.createElement(a);return d.className=b,c.appendChild(d),d}function c(a){var b=Array.prototype.slice,c=b.apply(arguments,[1]);return function(){return a.apply(null,c.concat(b.apply(arguments)))}}function d(a,b,c,d){var g=D(a,c),h=e(b,g),i=f("text",g,d);return{label:h,input:i}}function e(a,c){var d=b("label","",c);return d.innerHTML=a,d}function f(a,c,d){var e=b("input","",c);return e.type=a,d&&(e.maxLength=d),e}function g(a,b){a.style.left=j(100*b,0,100)+"%"}function h(a,b){a.style.top=j(100*b,0,100)+"%"}function i(a,b){a.style.background=b}function j(a,b,c){return Math.min(Math.max(a,b),c)}function k(a){var b=E.div("currentColorContainer",a),c=E.div("currentColor",b);return{change:function(a){E.BG(c,a.cssa())}}}function l(a,b,c){function d(){var a=[e];l.forEach(function(b){a.push(b.e.input.value/f)}),j||a.push(b.getAlpha()),b.set(a)}var e=c.space,f=c.limit||255,g=c.fix>=0?c.fix:0,h=(""+f).length+g;h=g?h+1:h;var i=e.split(""),j="A"==e[e.length-1];if(e=j?e.slice(0,-1):e,["RGB","HSL","HSV","CMYK"].indexOf(e)<0)return console.warn("Invalid field names",e);var k=E.div("colorFields",a),l=i.map(function(a){a=a.toLowerCase();var b=E.labelInput("color "+a,a,k,h);return b.input.onkeyup=d,{name:a,e:b}});return{change:function(a){l.forEach(function(b){b.e.input.value=(a[b.name]()*f).toFixed(g)})}}}function m(a,b){function c(a){var c=E.clamp(a.y,0,1);E.Y(a.pointer,c),b.setAlpha(1-c)}var d=C.slider({parent:a,"class":"oned alpha",cbs:{begin:c,change:c}});return{change:function(a){E.Y(d.pointer,1-a.alpha())}}}function n(a,b,c){var d=E.labelInput("hex",c.label||"",a,7);return d.input.value="#",d.input.onkeyup=function(a){var c=a.keyCode||a.which,d=a.target.value;d="#"==d[0]?d:"#"+d,d=p(d,7,"0"),13==c&&b.set(d)},d.input.onblur=function(a){b.set(a.target.value)},{change:function(a){d.input.value="#"==d.input.value[0]?"#":"",d.input.value+=a.hex().slice(1)}}}function o(a,b,c){var d=E.e("a",c["class"]||"close",a);d.href="#",d.innerHTML=c.label||"Close",d.onclick=function(a){a.preventDefault(),b.hide()}}function p(a,b,c){for(var d=a,e=a.length;b>e;e++)d+=c;return d}function q(b,c){E.BG(b,new a.HSV(c,1,1).cssa())}function r(a){function b(a){k=g.xy(k,{x:E.clamp(a.x,0,1),y:E.clamp(a.y,0,1)},h,i),d()}function c(a){k=g.z(k,E.clamp(a.y,0,1),h,i),d()}function d(a){a=x(a)?a:[];for(var b,c=l.change,d=0,e=c.length;e>d;d++)b=c[d],-1==a.indexOf(b.name)&&b.fn(k)}function e(){if(!j.equals(k)){for(var a=0,b=l.done.length;b>a;a++)l.done[a].fn(k);j=k}}if(!a.e)return console.warn("colorjoe: missing element");var f=y(a.e)?document.getElementById(a.e):a.e;f.className="colorPicker";var g=a.cbs,h=C.xyslider({parent:f,"class":"twod",cbs:{begin:b,change:b,end:e}}),i=C.slider({parent:f,"class":"oned",cbs:{begin:c,change:c,end:e}}),j=s(a.color),k=g.init(j,h,i),l={change:[],done:[]},m={e:f,update:function(a){return d(a),this},hide:function(){return f.style.display="none",this},show:function(){return f.style.display="",this},get:function(){return k},set:function(a){var b=this.get();return k=g.init(s(a),h,i),b.equals(k)||this.update(),this},getAlpha:function(){return k.alpha()},setAlpha:function(a){return k=k.alpha(a),this.update(),this},on:function(a,b,c){return"change"==a||"done"==a?l[a].push({name:c,fn:b}):console.warn('Passed invalid evt name "'+a+'" to colorjoe.on'),this},removeAllListeners:function(a){if(a)delete l[a];else for(var b in l)delete l[b];return this}};return t(f,m,a.extras),d(),m}function s(b){if(!z(b))return a("#000");if(b.isColor)return b;var c=a(b);return c?c:(z(b)&&console.warn("Passed invalid color to colorjoe, using black instead"),a("#000"))}function t(a,b,c){if(c){var d,e,f,g=E.div("extras",a);c.forEach(function(a,c){if(x(a)?(e=a[0],f=a.length>1?a[1]:{}):(e=a,f={}),extra=e in G._extras?G._extras[e]:null){d=extra(g,u(b,e+c),f);for(var h in d)b.on(h,d[h],e)}})}}function u(a,b){var c=v(a);return c.update=function(){a.update([b])},c}function v(a){var b={};for(var c in a)b[c]=a[c];return b}function w(a,b){return b.map(a).filter(B).length==b.length}function x(a){return"[object Array]"===Object.prototype.toString.call(a)}function y(a){return"string"==typeof a}function z(a){return"undefined"!=typeof a}function A(a){return"function"==typeof a}function B(a){return a}var C=function(){function a(a,b){return a?(g()?h(a,b,"touchstart","touchmove","touchend"):h(a,b,"mousedown","mousemove","mouseup"),void 0):(console.warn("drag is missing elem!"),void 0)}function b(b){var c=e(b["class"]||"",b.parent),f=e("pointer",c);return e("shape shape1",f),e("shape shape2",f),e("bg bg1",c),e("bg bg2",c),a(c,d(b.cbs,f)),{background:c,pointer:f}}function c(b){var c=e(b["class"],b.parent),f=e("pointer",c);return e("shape",f),e("bg",c),a(c,d(b.cbs,f)),{background:c,pointer:f}}function d(a,b){function c(a){return function(c){c.pointer=b,a(c)}}var d={};for(var e in a)d[e]=c(a[e]);return d}function e(a,b){return f("div",a,b)}function f(a,b,c){var d=document.createElement(a);return b&&(d.className=b),c.appendChild(d),d}function g(){return"undefined"!=typeof window.ontouchstart}function h(a,b,c,d,e){var f=!1;b=k(b);var g=b.begin,h=b.change,l=b.end;i(a,c,function(b){function c(){f=!1,j(document,d,k),j(document,e,c),n(l,a,b)}f=!0;var k=o(n,h,a);i(document,d,k),i(document,e,c),n(g,a,b)})}function i(a,b,c){a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent&&a.attachEvent("on"+b,c)}function j(a,b,c){a.removeEventListener?a.removeEventListener(b,c,!1):a.detachEvent&&a.detachEvent("on"+b,c)}function k(a){if(a)return{begin:a.begin||m,change:a.change||m,end:a.end||m};var b,c;return{begin:function(a){b={x:a.elem.offsetLeft,y:a.elem.offsetTop},c=a.cursor},change:function(a){l(a.elem,"left",b.x+a.cursor.x-c.x+"px"),l(a.elem,"top",b.y+a.cursor.y-c.y+"px")},end:m}}function l(a,b,c){a.style[b]=c}function m(){}function n(a,b,c){c.preventDefault();var d=p(b),e=b.clientWidth,f=b.clientHeight,g={x:q(b,c),y:r(b,c)},h=(g.x-d.x)/e,i=(g.y-d.y)/f;a({x:isNaN(h)?0:h,y:isNaN(i)?0:i,cursor:g,elem:b,e:c})}function o(a){var b=Array.prototype.slice,c=b.apply(arguments,[1]);return function(){return a.apply(null,c.concat(b.apply(arguments)))}}function p(a){var b=0,c=0;if(a.offsetParent)do b+=a.offsetLeft,c+=a.offsetTop;while(a=a.offsetParent);return{x:b,y:c}}function q(a,b){if(t(a)){var c=parseInt(u(document.body,"marginLeft"),10)-s(a,"scrollLeft")+window.pageXOffset+a.style.marginLeft;return b.clientX-c}return b.pageX?b.pageX:b.clientX?b.clientX+document.body.scrollLeft:void 0}function r(a,b){if(t(a)){var c=parseInt(u(document.body,"marginTop"),10)-s(a,"scrollTop")+window.pageYOffset+a.style.marginTop;return b.clientY-c}return b.pageY?b.pageY:b.clientY?b.clientY+document.body.scrollTop:void 0}function s(a,b){for(var c=0;"HTML"!=a.nodeName;)c+=a[b],a=a.parentNode;return c}function t(a){for(;"HTML"!=a.nodeName&&"fixed"!=v(a,"position");)a=a.parentNode;return"HTML"==a.nodeName?!1:!0}function u(a,b){return a.currentStyle?a.currentStyle[b]:document.defaultView&&document.defaultView.getComputedStyle?document.defaultView.getComputedStyle(a,"")[b]:a.style[b]}function v(a,b){var c;return c=window.getComputedStyle?window.getComputedStyle(a,null):a.currentStyle,c[b]}return a.xyslider=b,a.slider=c,a}(),D=c(b,"div"),E={clamp:j,e:b,div:D,partial:c,labelInput:d,X:g,Y:h,BG:i},F={currentColor:k,fields:l,hex:n,alpha:m,close:o},G=function(a){return w(A,[a.init,a.xy,a.z])?function(b,c,d){return r({e:b,color:c,cbs:a,extras:d})}:console.warn("colorjoe: missing cb")};G.rgb=G({init:function(b,c,d){var e=a(b).hsl();return this.xy(e,{x:e.saturation(),y:1-e.value()},c,d),this.z(e,e.hue(),c,d),e},xy:function(a,b,c){return E.X(c.pointer,b.x),E.Y(c.pointer,b.y),a.saturation(b.x).value(1-b.y)},z:function(a,b,c,d){return E.Y(d.pointer,b),q(c.background,b),a.hue(b)}}),G.hsl=G({init:function(b,c,d){var e=a(b).hsl();return this.xy(e,{x:e.hue(),y:1-e.saturation()},c,d),this.z(e,1-e.lightness(),c,d),e},xy:function(a,b,c,d){return E.X(c.pointer,b.x),E.Y(c.pointer,b.y),q(d.background,b.x),a.hue(b.x).saturation(1-b.y)},z:function(a,b,c,d){return E.Y(d.pointer,b),a.lightness(1-b)}}),G._extras={},G.registerExtra=function(a,b){a in G._extras&&console.warn('Extra "'+a+'"has been registered already!'),G._extras[a]=b};for(var H in F)G.registerExtra(H,F[H]);return G});
View
2 package.json
@@ -2,7 +2,7 @@
"name": "colorjoe",
"description": "Scaleable color picker",
"author": "Juho Vepsalainen <bebraw@gmail.com>",
- "version": "0.9.1",
+ "version": "0.9.2",
"dependencies": {
"dragjs": "0.4.1"
},

0 comments on commit a5c540c

Please sign in to comment.
Something went wrong with that request. Please try again.