dat.gui/build/dat.gui.min.js

3 lines
87 KiB
JavaScript
Raw Normal View History

2017-09-26 08:18:17 +00:00
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.dat=t():e.dat=t()}(this,function(){return function(e){function t(o){if(n[o])return n[o].exports;var i=n[o]={exports:{},id:o,loaded:!1};return e[o].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var i=n(1),a=o(i);t.default=a.default,e.exports=t.default},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var i=n(2),a=o(i),l=n(6),r=o(l),d=n(3),u=o(d),s=n(7),f=o(s),_=n(8),c=o(_),p=n(10),h=o(p),b=n(11),m=o(b),g=n(12),x=o(g),y=n(13),v=o(y),w=n(14),C=o(w),E=n(15),k=o(E),S=n(16),A=o(S),O=n(17),T=o(O),R=n(18),N=o(R),L=n(19),j=o(L),B=n(9),M=o(B),H=n(20),V=o(H);t.default={color:{Color:a.default,math:r.default,interpret:u.default},controllers:{Controller:f.default,BooleanController:c.default,OptionController:h.default,StringController:m.default,NumberController:x.default,NumberControllerBox:v.default,NumberControllerSlider:C.default,FunctionController:k.default,ColorController:A.default,BgColorController:T.default,NgColorController:N.default,GtColorController:j.default},dom:{dom:M.default},gui:{GUI:V.default},GUI:V.default},e.exports=t.default},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t,n){Object.defineProperty(e,t,{get:function(){return"RGB"===this.__state.space?this.__state[t]:(h.recalculateRGB(this,t,n),this.__state[t])},set:function(e){"RGB"!==this.__state.space&&(h.recalculateRGB(this,t,n),this.__state.space="RGB"),this.__state[t]=e}})}function l(e,t){Object.defineProperty(e,t,{get:function(){return"HSV"===this.__state.space?this.__state[t]:(h.recalculateHSV(this),this.__state[t])},set:function(e){"HSV"!==this.__state.space&&(h.recalculateHSV(this),this.__state.space="HSV"),this.__state[t]=e}})}t.__esModule=!0;var r=n(3),d=o(r),u=n(6),s=o(u),f=n(4),_=o(f),c=n(5),p=o(c),h=function(){function e(){if(i(this,e),this.__state=d.default.apply(this,arguments),this.__state===!1)throw new Error("Failed to interpret color arguments");this.__state.a=this.__state.a||1}return e.prototype.toString=function(){return(0,_.default)(this)},e.prototype.toHexString=function(){return(0,_.default)(this,!0)},e.prototype.toOriginal=function(){return this.__state.conversion.write(this)},e}();h.recalculateRGB=function(e,t,n){if("HEX"===e.__state.space)e.__state[t]=s.default.component_from_hex(e.__state.hex,n);else{if("HSV"!==e.__state.space)throw new Error("Corrupted color state");p.default.extend(e.__state,s.default.hsv_to_rgb(e.__state.h,e.__state.s,e.__state.v))}},h.recalculateHSV=function(e){var t=s.default.rgb_to_hsv(e.r,e.g,e.b);p.default.extend(e.__state,{s:t.s,v:t.v}),p.default.isNaN(t.h)?p.default.isUndefined(e.__state.h)&&(e.__state.h=0):e.__state.h=t.h},h.COMPONENTS=["r","g","b","h","s","v","hex","a"],a(h.prototype,"r",2),a(h.prototype,"g",1),a(h.prototype,"b",0),l(h.prototype,"h"),l(h.prototype,"s"),l(h.prototype,"v"),Object.defineProperty(h.prototype,"a",{get:function(){return this.__state.a},set:function(e){this.__state.a=e}}),Object.defineProperty(h.prototype,"hex",{get:function(){return"HEX"!==!this.__state.space&&(this.__state.hex=s.default.rgb_to_hex(this.r,this.g,this.b)),this.__state.hex},set:function(e){this.__state.space="HEX",this.__state.hex=e}}),t.default=h,e.exports=t.default},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var i=n(4),a=o(i),l=n(5),r=o(l),d=[{litmus:r.default.isString,conversions:{THREE_CHAR_HEX:{read:function(e){var t=e.match(/^#([A-F0-9])([A-F0-9])([A-F0-9])$/i);return null!==t&&{space:"HEX",hex:parseInt("0x"+t[1].toString()+t[1].toString()+t[2].toString()+t[2].toString()+t[3].toString()+t[3].toString(),0)}},write:a.default},SIX_CHAR_HEX:{read:function(e){var t=e.match(/
}function r(e,t,n,o){e.style.background="",g.default.each(y,function(i){e.style.cssText+="background: "+i+"linear-gradient("+t+", "+n+" 0%, "+o+" 100%); "})}function d(e){e.style.background="",e.style.cssText+="background: -moz-linear-gradient(top, #ff0000 0%, #ff00ff 17%, #0000ff 34%, #00ffff 50%, #00ff00 67%, #ffff00 84%, #ff0000 100%);",e.style.cssText+="background: -webkit-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: -o-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: -ms-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);"}t.__esModule=!0;var u=n(7),s=o(u),f=n(9),_=o(f),c=n(2),p=o(c),h=n(3),b=o(h),m=n(5),g=o(m),x=function(e){function t(n,o){function l(e){C(e),_.default.bind(window,"mousemove",C),_.default.bind(window,"mouseup",s)}function u(e){w(e),_.default.bind(window,"mousemove",w),_.default.bind(window,"mouseup",f)}function s(){_.default.unbind(window,"mousemove",C),_.default.unbind(window,"mouseup",s),y()}function f(){_.default.unbind(window,"mousemove",w),_.default.unbind(window,"mouseup",f),v()}function c(){var e=(0,b.default)(this.value);e!==!1?(A.__color.__state=e,A.setValue(A.__color.toOriginal())):this.value=A.__color.toString()}function h(){var e=(0,b.default)(this.value);e!==!1?(A.__color2.__state=e,A.setValue2(A.__color2.toOriginal())):this.value=A.__color2.toString()}function m(){_.default.unbind(window,"mousemove",k),_.default.unbind(window,"mouseup",m),y()}function x(){_.default.unbind(window,"mousemove",E),_.default.unbind(window,"mouseup",x),v()}function y(){A.__onFinishChange&&A.__onFinishChange.call(A,A.__color2.toOriginal())}function v(){A.__onFinishChange&&A.__onFinishChange.call(A,A.__color.toOriginal())}function w(e){e.preventDefault();var t=A.__saturation_field2.getBoundingClientRect(),n=(e.clientX-t.left)/(t.right-t.left),o=1-(e.clientY-t.top)/(t.bottom-t.top);return o>1?o=1:o<0&&(o=0),n>1?n=1:n<0&&(n=0),A.__color2.v=o,A.__color2.s=n,A.setValue2(A.__color2.toOriginal()),!1}function C(e){e.preventDefault();var t=A.__saturation_field.getBoundingClientRect(),n=(e.clientX-t.left)/(t.right-t.left),o=1-(e.clientY-t.top)/(t.bottom-t.top);return o>1?o=1:o<0&&(o=0),n>1?n=1:n<0&&(n=0),A.__color.v=o,A.__color.s=n,A.setValue(A.__color.toOriginal()),!1}function E(e){e.preventDefault();var t=A.__hue_field2.getBoundingClientRect(),n=1-(e.clientY-t.top)/(t.bottom-t.top);return n>1?n=1:n<0&&(n=0),A.__color2.h=360*n,A.setValue2(A.__color2.toOriginal()),!1}function k(e){e.preventDefault();var t=A.__hue_field.getBoundingClientRect(),n=1-(e.clientY-t.top)/(t.bottom-t.top);return n>1?n=1:n<0&&(n=0),A.__color.h=360*n,A.setValue(A.__color.toOriginal()),!1}i(this,t);var S=a(this,e.call(this,n,o));S.__color=new p.default(S.getValue()),S.value2="#FFee00",S.object[S.property+"bg"]&&(S.value2=S.object[S.property+"bg"]),S.__color2=new p.default(S.value2),S.__temp=new p.default(0),S.__temp2=new p.default(0);var A=S;S.domElement=document.createElement("div"),_.default.makeSelectable(S.domElement,!1),S.__selector=document.createElement("div"),S.__saturation_field=document.createElement("div"),S.__saturation_field.className="saturation-field",S.__saturation_field2=document.createElement("div"),S.__saturation_field2.className="saturation-field",S.__field_knob=document.createElement("div"),S.__field_knob.className="field-knob",S.__field_knob_border="2px solid ",S.__field_knob2=document.createElement("div"),S.__field_knob2.className="field-knob",S.__field_knob_border2="2px solid ",S.__hue_knob=document.createElement("div"),S.__hue_knob.className="hue-knob",S.__hue_knob2=document.createElement("div"),S.__hue_knob2.className="hue-knob",S.__hue_field=document.createElement("div"),S.__hue_field.className="hue-field",S.__hue_field2=document.createElement("d
l(e,f,a),e.__controllers.push(a),a}function u(e,t,n,o){if(void 0===t[n])throw new Error('Object "'+t+'" has no property "'+n+'"');var a=void 0;if(o.color)a=new U.default(t,n);else{var d=[t,n].concat(o.factoryArgs);a=A.default.apply(e,d)}o.before instanceof T.default&&(o.before=o.before.__li),r(e,a),q.default.addClass(a.domElement,"c");var u=document.createElement("span");q.default.addClass(u,"property-name"),u.innerHTML=a.property;var s=document.createElement("div");s.appendChild(u),s.appendChild(a.domElement);var f=i(e,s,o.before);return q.default.addClass(f,_e.CLASS_CONTROLLER_ROW),a instanceof F.default?q.default.addClass(f,"color"):a instanceof U.default?q.default.addClass(f,"color"):q.default.addClass(f,v(a.getValue())),l(e,f,a),e.__controllers.push(a),a}function s(e,t,n,o){if(void 0===t[n])throw new Error('Object "'+t+'" has no property "'+n+'"');var a=void 0;if(o.color)a=new X.default(t,n);else{var d=[t,n].concat(o.factoryArgs);a=A.default.apply(e,d)}o.before instanceof T.default&&(o.before=o.before.__li),r(e,a),q.default.addClass(a.domElement,"c");var u=document.createElement("span");q.default.addClass(u,"property-name"),u.innerHTML=a.property;var s=document.createElement("div");s.appendChild(u),s.appendChild(a.domElement);var f=i(e,s,o.before);return q.default.addClass(f,_e.CLASS_CONTROLLER_ROW),a instanceof F.default?q.default.addClass(f,"color"):a instanceof U.default?q.default.addClass(f,"color"):q.default.addClass(f,v(a.getValue())),l(e,f,a),e.__controllers.push(a),a}function f(e,t,n,o){if(void 0===t[n])throw new Error('Object "'+t+'" has no property "'+n+'"');var a=void 0;if(o.color)a=new F.default(t,n);else{var d=[t,n].concat(o.factoryArgs);a=A.default.apply(e,d)}o.before instanceof T.default&&(o.before=o.before.__li),r(e,a),q.default.addClass(a.domElement,"c");var u=document.createElement("span");q.default.addClass(u,"property-name"),u.innerHTML=a.property;var s=document.createElement("div");s.appendChild(u),s.appendChild(a.domElement);var f=i(e,s,o.before);return q.default.addClass(f,_e.CLASS_CONTROLLER_ROW),a instanceof F.default?q.default.addClass(f,"color"):a instanceof z.default?q.default.addClass(f,"color"):q.default.addClass(f,v(a.getValue())),l(e,f,a),e.__controllers.push(a),a}function _(e,t){return document.location.href+"."+t}function c(e,t,n){var o=document.createElement("option");o.innerHTML=t,o.value=t,e.__preset_select.appendChild(o),n&&(e.__preset_select.selectedIndex=e.__preset_select.length-1)}function p(e,t){t.style.display=e.useLocalStorage?"block":"none"}function h(e){var t=e.__save_row=document.createElement("li");q.default.addClass(e.domElement,"has-save"),e.__ul.insertBefore(t,e.__ul.firstChild),q.default.addClass(t,"save-row");var n=document.createElement("span");n.innerHTML="&nbsp;",q.default.addClass(n,"button gears");var o=document.createElement("span");o.innerHTML="Save",q.default.addClass(o,"button"),q.default.addClass(o,"save");var i=document.createElement("span");i.innerHTML="New",q.default.addClass(i,"button"),q.default.addClass(i,"save-as");var a=document.createElement("span");a.innerHTML="Revert",q.default.addClass(a,"button"),q.default.addClass(a,"revert");var l=e.__preset_select=document.createElement("select");if(e.load&&e.load.remembered?$.default.each(e.load.remembered,function(t,n){c(e,n,n===e.preset)}):c(e,ae,!1),q.default.bind(l,"change",function(){for(var t=0;t<e.__preset_select.length;t++)e.__preset_select[t].innerHTML=e.__preset_select[t].value;e.preset=this.value}),t.appendChild(l),t.appendChild(n),t.appendChild(o),t.appendChild(i),t.appendChild(a),le){var r=document.getElementById("dg-local-explain"),d=document.getElementById("dg-local-storage"),u=document.getElementById("dg-save-locally");u.style.display="block","true"===localStorage.getItem(_(e,"isLocal"))&&d.setAttribute("checked","checked"),p(e,r),q.default.bind(d,"change",function(){e.useLocalStorage=!e.useLocalStorage,p(e,r)})}var s=document.getElementById("dg-new-constructor");q.default.bind(s,"keydown",function(e){!e.metaKey||67!==e.which&&67!==e.keyCode||re.hide()}),q.default.bind(n,"click",function