diff --git a/README.md b/README.md index ac44f24b..2f9dc5ee 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ alt="JSDelivr download count" src="https://data.jsdelivr.com/v1/package/npm/@simonwep/pickr/badge"> Current version + src="https://img.shields.io/badge/version-0.5.0-f1c40f.svg?style=popout-square"> Support me diff --git a/dist/pickr.es5.min.js b/dist/pickr.es5.min.js index 1952ee4b..9d446dcc 100644 --- a/dist/pickr.es5.min.js +++ b/dist/pickr.es5.min.js @@ -1,3 +1,3 @@ -/*! Pickr 0.4.11 MIT | https://github.com/Simonwep/pickr */ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Pickr=e():t.Pickr=e()}(window,function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=1)}([function(t,e,n){},function(t,e,n){"use strict";n.r(e);var r={};n.r(r),n.d(r,"once",function(){return a}),n.d(r,"on",function(){return c}),n.d(r,"off",function(){return s}),n.d(r,"createElementFromString",function(){return l}),n.d(r,"removeAttribute",function(){return p}),n.d(r,"createFromTemplate",function(){return h}),n.d(r,"eventPath",function(){return d}),n.d(r,"adjustableInputNumbers",function(){return f}),n.d(r,"padStart",function(){return v});var o={};n.r(o),n.d(o,"hsvToRgb",function(){return k}),n.d(o,"hsvToHex",function(){return A}),n.d(o,"hsvToCmyk",function(){return C}),n.d(o,"hsvToHsl",function(){return S}),n.d(o,"parseToHSV",function(){return H});n(0);function i(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var a=function(t,e,n,r){return c(t,e,function t(){n.apply(this,arguments),this.removeEventListener(e,t)},r)},c=u.bind(null,"addEventListener"),s=u.bind(null,"removeEventListener");function u(t,e,n,r){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};return e instanceof HTMLCollection||e instanceof NodeList?e=Array.from(e):Array.isArray(e)||(e=[e]),Array.isArray(n)||(n=[n]),e.forEach(function(e){return n.forEach(function(n){return e[t](n,r,function(t){for(var e=1;e1&&void 0!==arguments[1]?arguments[1]:{},r=p(e,"data-con"),o=p(e,"data-key");o&&(n[o]=e);for(var i=Array.from(e.children),a=r?n[r]={}:n,c=0,s=i;c1&&void 0!==arguments[1])||arguments[1],n=function(t){return t>="0"&&t<="9"||"-"===t||"."===t};function r(r){for(var o=t.value,i=t.selectionStart,a=i,c="",s=i-1;s>0&&n(o[s]);s--)c=o[s]+c,a--;for(var u=i,l=o.length;u0&&!isNaN(c)&&isFinite(c)){var p=r.deltaY<0?1:-1,h=r.ctrlKey?5*p:p,d=Number(c)+h;!e&&d<0&&(d=0);var f=o.substr(0,a)+d+o.substring(a+c.length,o.length),v=a+String(d).length;t.value=f,t.focus(),t.setSelectionRange(v,v)}r.preventDefault(),t.dispatchEvent(new Event("input"))}c(t,"focus",function(){return c(window,"wheel",r,{passive:!1})}),c(t,"blur",function(){return s(window,"wheel",r)})}function v(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:" ";return(e-=t.length)<=0||!n.length?String(t):(e>n.length&&(n+=n.repeat(e/n.length)),n.slice(0,e)+String(t))}function y(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=[],r=!0,o=!1,i=void 0;try{for(var a,c=t[Symbol.iterator]();!(r=(a=c.next()).done)&&(n.push(a.value),!e||n.length!==e);r=!0);}catch(t){o=!0,i=t}finally{try{r||null==c.return||c.return()}finally{if(o)throw i}}return n}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function m(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e1&&(r-=1)}return[360*r,100*o,100*a]}function j(t,e,n,r){return e/=100,n/=100,m(O(255*(1-g(1,(t/=100)*(1-(r/=100))+r)),255*(1-g(1,e*(1-r)+r)),255*(1-g(1,n*(1-r)+r))))}function E(t,e,n){return e/=100,[t,2*(e*=(n/=100)<.5?n:1-n)/(n+e)*100,100*(n+e)]}function x(t){return O.apply(void 0,m(t.match(/.{2}/g).map(function(t){return parseInt(t,16)})))}function H(t){var e,n;t=t.match(/^[a-zA-Z]+$/)?(e=t,(n=document.createElement("canvas").getContext("2d")).fillStyle=e,n.fillStyle):t;var r,o={cmyk:/^cmyk[\D]+(\d+)[\D]+(\d+)[\D]+(\d+)[\D]+(\d+)/i,rgba:/^(rgb|rgba)[\D]+(\d+)[\D]+(\d+)[\D]+(\d+)[\D]*?([\d.]+|$)/i,hsla:/^(hsl|hsla)[\D]+(\d+)[\D]+(\d+)[\D]+(\d+)[\D]*?([\d.]+|$)/i,hsva:/^(hsv|hsva)[\D]+(\d+)[\D]+(\d+)[\D]+(\d+)[\D]*?([\d.]+|$)/i,hex:/^#?(([\dA-Fa-f]{3,4})|([\dA-Fa-f]{6})|([\dA-Fa-f]{8}))$/i},i=function(t){return t.map(function(t){return/^(|\d+)\.\d+|\d+$/.test(t)?Number(t):void 0})};for(var a in o)if(r=o[a].exec(t))switch(a){case"cmyk":var c=y(i(r),5),s=c[1],u=c[2],l=c[3],p=c[4];if(s>100||u>100||l>100||p>100)break;return{values:[].concat(m(j(s,u,l,p)),[1]),type:a};case"rgba":var h=y(i(r),6),d=h[2],f=h[3],v=h[4],g=h[5],b=void 0===g?1:g;if(d>255||f>255||v>255||b<0||b>1)break;return{values:[].concat(m(O(d,f,v)),[b]),type:a};case"hex":var _=function(t,e){return[t.substring(0,e),t.substring(e,t.length)]},w=y(r,2)[1];3===w.length?w+="F":6===w.length&&(w+="FF");var k=void 0;if(4===w.length){var A=y(_(w,3).map(function(t){return t+t}),2);w=A[0],k=A[1]}else if(8===w.length){var C=y(_(w,6),2);w=C[0],k=C[1]}return k=parseInt(k,16)/255,{values:[].concat(m(x(w)),[k]),type:a};case"hsla":var S=y(i(r),6),H=S[2],B=S[3],L=S[4],P=S[5],R=void 0===P?1:P;if(H>360||B>100||L>100||R<0||R>1)break;return{values:[].concat(m(E(H,B,L)),[R]),type:a};case"hsva":var D=y(i(r),6),T=D[2],F=D[3],M=D[4],N=D[5],X=void 0===N?1:N;if(T>360||F>100||M>100||X<0||X>1)break;return{values:[T,F,M,X],type:a}}return{values:null,type:null}}function B(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,i=Math.ceil,a={h:t,s:e,v:n,a:r,toHSVA:function(){var t=[a.h,a.s,a.v],e=t.map(i);return t.push(a.a),t.toString=function(){return"hsva(".concat(e[0],", ").concat(e[1],"%, ").concat(e[2],"%, ").concat(a.a.toFixed(1),")")},t},toHSLA:function(){var t=S(a.h,a.s,a.v),e=t.map(i);return t.push(a.a),t.toString=function(){return"hsla(".concat(e[0],", ").concat(e[1],"%, ").concat(e[2],"%, ").concat(a.a.toFixed(1),")")},t},toRGBA:function(){var t=k(a.h,a.s,a.v),e=t.map(i);return t.push(a.a),t.toString=function(){return"rgba(".concat(e[0],", ").concat(e[1],", ").concat(e[2],", ").concat(a.a.toFixed(1),")")},t},toCMYK:function(){var t=C(a.h,a.s,a.v),e=t.map(i);return t.toString=function(){return"cmyk(".concat(e[0],"%, ").concat(e[1],"%, ").concat(e[2],"%, ").concat(e[3],"%)")},t},toHEXA:function(){var t=A.apply(o,[a.h,a.s,a.v]);return t.toString=function(){var e=a.a>=1?"":v(Number((255*a.a).toFixed(0)).toString(16).toUpperCase(),2,"0");return"#".concat(t.join("").toUpperCase()+e)},t},clone:function(){return B(a.h,a.s,a.v,a.a)}};return a.toHEX=a.toHEXA,a}function L(t){var e={options:Object.assign({lockX:!1,lockY:!1,onchange:function(){return 0}},t),_tapstart:function(t){c(document,["mouseup","touchend","touchcancel"],e._tapstop),c(document,["mousemove","touchmove"],e._tapmove),t.preventDefault(),e._tapmove(t)},_tapmove:function(t){var n=e.options,r=e.cache,o=n.element,i=e.options.wrapper.getBoundingClientRect(),a=0,c=0;if(t){var s=t&&t.touches&&t.touches[0];a=t?(s||t).clientX:0,c=t?(s||t).clientY:0,ai.left+i.width&&(a=i.left+i.width),ci.top+i.height&&(c=i.top+i.height),a-=i.left,c-=i.top}else r&&(a=r.x*i.width,c=r.y*i.height);n.lockX||(o.style.left="calc(".concat(a/i.width*100,"% - ").concat(o.offsetWidth/2,"px)")),n.lockY||(o.style.top="calc(".concat(c/i.height*100,"% - ").concat(o.offsetWidth/2,"px)")),e.cache={x:a/i.width,y:c/i.height},n.onchange(a,c)},_tapstop:function(){s(document,["mouseup","touchend","touchcancel"],e._tapstop),s(document,["mousemove","touchmove"],e._tapmove)},trigger:function(){e._tapmove()},update:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=e.options.wrapper.getBoundingClientRect();e._tapmove({clientX:r.left+t,clientY:r.top+n})},destroy:function(){var t=e.options,n=e._tapstart;s([t.wrapper,t.element],"mousedown",n),s([t.wrapper,t.element],"touchstart",n,{passive:!1})}},n=e.options,r=e._tapstart;return c([n.wrapper,n.element],"mousedown",r),c([n.wrapper,n.element],"touchstart",r,{passive:!1}),e}function P(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e0&&void 0!==arguments[0]?arguments[0]:{};t=Object.assign({onchange:function(){return 0},className:"",elements:[]},t);var e=c(t.elements,"click",function(e){t.elements.forEach(function(n){return n.classList[e.target===n?"add":"remove"](t.className)}),t.onchange(e)});return{destroy:function(){return s.apply(r,P(e))}}}function D(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);ec?p.left:h<0?p.right:h,Object.assign(e.style,{left:"".concat(n,"px"),top:"".concat(r,"px")})}}),this.options=e=Object.assign({useAsButton:!1,disabled:!1,comparison:!0,components:{interaction:{}},strings:{},swatches:null,inline:!1,default:"fff",defaultRepresentation:null,position:"middle",adjustableNumbers:!0,showAlways:!1,closeWithKey:"Escape"},e);var i=e,a=i.swatches,c=i.inline,s=i.components;s.interaction||(s.interaction={});var u=s.preview,l=s.opacity,p=s.hue,h=s.palette;s.palette=h||u||l||p,c&&(e.showAlways=!0),this._preBuild(),this._buildComponents(),this._bindEvents(),this._finalBuild(),a&&a.length&&a.forEach(function(t){return o.addSwatch(t)});var d=this._root.button;requestAnimationFrame(function t(){if(null===d.offsetParent&&d!==document.body)return requestAnimationFrame(t.bind(this));this.setColor(e.default),this._rePositioningPicker(),e.defaultRepresentation&&(this._representation=e.defaultRepresentation,this.setColorRepresentation(this._representation)),e.showAlways&&this.show(),this._initializingActive=!1,this._emit("init")}.bind(this))}var e,n,o;return e=t,(n=[{key:"_preBuild",value:function(){var t,e,n,r,o,i,a,c,s=this.options;"string"==typeof s.el&&(s.el=s.el.split(/>>/g).reduce(function(t,e,n,r){return t=t.querySelector(e),n\n \n '.concat(r?"":'','\n\n
\n
\n
\n \n
\n
\n\n
\n
\n
\n
\n\n
\n
\n
\n
\n\n
\n
\n
\n
\n
\n\n
\n\n
\n \n\n \n \n \n \n \n\n \n \n
\n
\n \n ")),(c=a.interaction).options.find(function(t){return!t.hidden&&!t.classList.add("active")}),c.type=function(){return c.options.find(function(t){return t.classList.contains("active")})},a),s.useAsButton&&(this._root.button=s.el),document.body.appendChild(this._root.root)}},{key:"_finalBuild",value:function(){var t=this.options,e=this._root;if(document.body.removeChild(e.root),t.inline){var n=t.el.parentElement;n.lastChild===t.el?n.appendChild(e.app):n.insertBefore(e.app,t.el.nextSibling)}else document.body.appendChild(e.app);t.useAsButton||t.el.parentNode.replaceChild(e.root,t.el),t.disabled&&this.disable(),t.comparison||(e.button.style.transition="none",t.useAsButton||(e.preview.lastColor.style.transition="none")),this.hide()}},{key:"_buildComponents",value:function(){var t=this,e=this.options.components,n={palette:L({element:t._root.palette.picker,wrapper:t._root.palette.palette,onchange:function(n,r){if(e.palette){var o=t._color,i=t._root,a=t.options;o.s=n/this.wrapper.offsetWidth*100,o.v=100-r/this.wrapper.offsetHeight*100,o.v<0&&(o.v=0);var c=o.toRGBA().toString();this.element.style.background=c,this.wrapper.style.background="\n linear-gradient(to top, rgba(0, 0, 0, ".concat(o.a,"), transparent), \n linear-gradient(to left, hsla(").concat(o.h,", 100%, 50%, ").concat(o.a,"), rgba(255, 255, 255, ").concat(o.a,"))\n "),a.comparison||(i.button.style.color=c,a.useAsButton||(i.preview.lastColor.style.color=c)),i.preview.currentColor.style.color=c,t._recalc&&t._updateOutput(),i.button.classList.remove("clear")}}}),hue:L({lockX:!0,element:t._root.hue.picker,wrapper:t._root.hue.slider,onchange:function(r,o){e.hue&&e.palette&&(t._color.h=o/this.wrapper.offsetHeight*360,this.element.style.backgroundColor="hsl(".concat(t._color.h,", 100%, 50%)"),n.palette.trigger())}}),opacity:L({lockX:!0,element:t._root.opacity.picker,wrapper:t._root.opacity.slider,onchange:function(n,r){e.opacity&&e.palette&&(t._color.a=Math.round(r/this.wrapper.offsetHeight*100)/100,this.element.style.background="rgba(0, 0, 0, ".concat(t._color.a,")"),t.components.palette.trigger())}}),selectable:R({elements:t._root.interaction.options,className:"active",onchange:function(e){t._representation=e.target.getAttribute("data-type").toUpperCase(),t._updateOutput()}})};this.components=n}},{key:"_bindEvents",value:function(){var t,e=this,n=this._root,r=this.options,o=[c(n.interaction.clear,"click",function(){return e._clearColor()}),c(n.preview.lastColor,"click",function(){return e.setHSVA.apply(e,D(e._lastColor.toHSVA()))}),c(n.interaction.save,"click",function(){!e.applyColor()&&!r.showAlways&&e.hide()}),c(n.interaction.result,["keyup","input"],function(t){e._recalc=!1,e.setColor(t.target.value,!0)&&!e._initializingActive&&e._emit("change",e._color),t.stopImmediatePropagation()}),c([n.palette.palette,n.palette.picker,n.hue.slider,n.hue.picker,n.opacity.slider,n.opacity.picker],["mousedown","touchstart"],function(){return e._recalc=!0})];if(!r.showAlways){var i=r.closeWithKey;o.push(c(n.button,"click",function(){return e.isOpen()?e.hide():e.show()}),c(document,"keyup",function(t){return e.isOpen()&&(t.key===i||t.code===i)&&e.hide()}),c(document,["touchstart","mousedown"],function(t){e.isOpen()&&!d(t).some(function(t){return t===n.app||t===n.button})&&e.hide()},{capture:!0}))}(r.adjustableNumbers&&f(n.interaction.result,!1),r.inline)||o.push(c(window,["scroll","wheel","resize"],function(){e.isOpen()&&(e.hide(),t&&clearTimeout(t),t=setTimeout(function(){return e.show()},250))}));this._eventBindings=o}},{key:"_updateOutput",value:function(){if(this._root.interaction.type()){var t="to".concat(this._root.interaction.type().getAttribute("data-type"));this._root.interaction.result.value="function"==typeof this._color[t]?this._color[t]().toString():""}this._initializingActive||this._emit("change",this._color)}},{key:"_clearColor",value:function(){var t=this._root,e=this.options;e.useAsButton||(t.button.style.color="rgba(0, 0, 0, 0.15)"),t.button.classList.add("clear"),e.showAlways||this.hide(),this._initializingActive||this._emit("save",null)}},{key:"_emit",value:function(t){for(var e=this,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o'));return o.swatches.appendChild(a),r.push({element:a,hsvaColorObject:i}),this._eventBindings.push(c(a,"click",function(){e.setHSVA.apply(e,D(i.toHSVA()).concat([!0])),e._emit("swatchselect",i)})),!0}return!1}},{key:"removeSwatch",value:function(t){if("number"==typeof t){var e=this._swatchColors[t];if(e){var n=e.element;return this._root.swatches.removeChild(n),this._swatchColors.splice(t,1),!0}}return!1}},{key:"applyColor",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=this._root,n=e.preview,r=e.button,o=this._color.toRGBA().toString();n.lastColor.style.color=o,this.options.useAsButton||(r.style.color=o),r.classList.remove("clear"),this._lastColor=this._color.clone(),this._initializingActive||t||this._emit("save",this._color)}},{key:"destroy",value:function(){var t=this;this._eventBindings.forEach(function(t){return s.apply(r,D(t))}),Object.keys(this.components).forEach(function(e){return t.components[e].destroy()})}},{key:"destroyAndRemove",value:function(){this.destroy();var t=this._root.root;t.parentElement.removeChild(t);var e=this._root.app;e.parentElement.removeChild(e);var n=this;Object.keys(n).forEach(function(t){return n[t]=null})}},{key:"hide",value:function(){return this._root.app.classList.remove("visible"),this}},{key:"show",value:function(){if(!this.options.disabled)return this._root.app.classList.add("visible"),this._rePositioningPicker(),this}},{key:"isOpen",value:function(){return this._root.app.classList.contains("visible")}},{key:"setHSVA",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:360,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,o=arguments.length>4&&void 0!==arguments[4]&&arguments[4],i=this._recalc;if(this._recalc=!1,t<0||t>360||e<0||e>100||n<0||n>100||r<0||r>1)return!1;var a=this.components,c=a.hue,s=a.opacity,u=a.palette,l=c.options.wrapper.offsetHeight*(t/360);c.update(0,l);var p=s.options.wrapper.offsetHeight*r;s.update(0,p);var h=u.options.wrapper,d=h.offsetWidth*(e/100),f=h.offsetHeight*(1-n/100);return u.update(d,f),this._color=B(t,e,n,r),this._recalc=i,this._recalc&&this._updateOutput(),o||this.applyColor(),!0}},{key:"setColor",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(null===t)return this._clearColor(),!0;var n=H(t),r=n.values,o=n.type;if(r){var i=o.toUpperCase(),a=this._root.interaction.options,c=a.find(function(t){return t.getAttribute("data-type").startsWith(i)});if(c&&!c.hidden){var s=!0,u=!1,l=void 0;try{for(var p,h=a[Symbol.iterator]();!(s=(p=h.next()).done);s=!0){var d=p.value;d.classList[d===c?"add":"remove"]("active")}}catch(t){u=!0,l=t}finally{try{s||null==h.return||h.return()}finally{if(u)throw l}}}return this.setHSVA.apply(this,D(r).concat([e]))}}},{key:"setColorRepresentation",value:function(t){return t=t.toUpperCase(),!!this._root.interaction.options.find(function(e){return e.getAttribute("data-type").startsWith(t)&&!e.click()})}},{key:"getColorRepresentation",value:function(){return this._representation}},{key:"getColor",value:function(){return this._color}},{key:"getRoot",value:function(){return this._root}},{key:"disable",value:function(){return this.hide(),this.options.disabled=!0,this._root.button.classList.add("disabled"),this}},{key:"enable",value:function(){return this.options.disabled=!1,this._root.button.classList.remove("disabled"),this}}])&&T(e.prototype,n),o&&T(e,o),t}();M.utils={once:a,on:c,off:s,eventPath:d,createElementFromString:l,adjustableInputNumbers:f,removeAttribute:p,createFromTemplate:h},M.create=function(t){return new M(t)},M.version="0.4.11";e.default=M}]).default}); +/*! Pickr 0.5.0 MIT | https://github.com/Simonwep/pickr */ +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Pickr=e():t.Pickr=e()}(window,function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=1)}([function(t,e,n){},function(t,e,n){"use strict";n.r(e);var r={};n.r(r),n.d(r,"once",function(){return a}),n.d(r,"on",function(){return c}),n.d(r,"off",function(){return s}),n.d(r,"createElementFromString",function(){return l}),n.d(r,"removeAttribute",function(){return p}),n.d(r,"createFromTemplate",function(){return h}),n.d(r,"eventPath",function(){return d}),n.d(r,"adjustableInputNumbers",function(){return f}),n.d(r,"padStart",function(){return v});var o={};n.r(o),n.d(o,"hsvToRgb",function(){return k}),n.d(o,"hsvToHex",function(){return A}),n.d(o,"hsvToCmyk",function(){return C}),n.d(o,"hsvToHsl",function(){return S}),n.d(o,"parseToHSV",function(){return H});n(0);function i(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var a=function(t,e,n,r){return c(t,e,function t(){n.apply(this,arguments),this.removeEventListener(e,t)},r)},c=u.bind(null,"addEventListener"),s=u.bind(null,"removeEventListener");function u(t,e,n,r){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};return e instanceof HTMLCollection||e instanceof NodeList?e=Array.from(e):Array.isArray(e)||(e=[e]),Array.isArray(n)||(n=[n]),e.forEach(function(e){return n.forEach(function(n){return e[t](n,r,function(t){for(var e=1;e1&&void 0!==arguments[1]?arguments[1]:{},r=p(e,"data-con"),o=p(e,"data-key");o&&(n[o]=e);for(var i=Array.from(e.children),a=r?n[r]={}:n,c=0,s=i;c1&&void 0!==arguments[1])||arguments[1],n=function(t){return t>="0"&&t<="9"||"-"===t||"."===t};function r(r){for(var o=t.value,i=t.selectionStart,a=i,c="",s=i-1;s>0&&n(o[s]);s--)c=o[s]+c,a--;for(var u=i,l=o.length;u0&&!isNaN(c)&&isFinite(c)){var p=r.deltaY<0?1:-1,h=r.ctrlKey?5*p:p,d=Number(c)+h;!e&&d<0&&(d=0);var f=o.substr(0,a)+d+o.substring(a+c.length,o.length),v=a+String(d).length;t.value=f,t.focus(),t.setSelectionRange(v,v)}r.preventDefault(),t.dispatchEvent(new Event("input"))}c(t,"focus",function(){return c(window,"wheel",r,{passive:!1})}),c(t,"blur",function(){return s(window,"wheel",r)})}function v(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:" ";return(e-=t.length)<=0||!n.length?String(t):(e>n.length&&(n+=n.repeat(e/n.length)),n.slice(0,e)+String(t))}function y(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=[],r=!0,o=!1,i=void 0;try{for(var a,c=t[Symbol.iterator]();!(r=(a=c.next()).done)&&(n.push(a.value),!e||n.length!==e);r=!0);}catch(t){o=!0,i=t}finally{try{r||null==c.return||c.return()}finally{if(o)throw i}}return n}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function m(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e1&&(r-=1)}return[360*r,100*o,100*a]}function j(t,e,n,r){return e/=100,n/=100,m(O(255*(1-g(1,(t/=100)*(1-(r/=100))+r)),255*(1-g(1,e*(1-r)+r)),255*(1-g(1,n*(1-r)+r))))}function E(t,e,n){return e/=100,[t,2*(e*=(n/=100)<.5?n:1-n)/(n+e)*100,100*(n+e)]}function x(t){return O.apply(void 0,m(t.match(/.{2}/g).map(function(t){return parseInt(t,16)})))}function H(t){var e,n;t=t.match(/^[a-zA-Z]+$/)?(e=t,(n=document.createElement("canvas").getContext("2d")).fillStyle=e,n.fillStyle):t;var r,o={cmyk:/^cmyk[\D]+(\d+)[\D]+(\d+)[\D]+(\d+)[\D]+(\d+)/i,rgba:/^(rgb|rgba)[\D]+(\d+)[\D]+(\d+)[\D]+(\d+)[\D]*?([\d.]+|$)/i,hsla:/^(hsl|hsla)[\D]+(\d+)[\D]+(\d+)[\D]+(\d+)[\D]*?([\d.]+|$)/i,hsva:/^(hsv|hsva)[\D]+(\d+)[\D]+(\d+)[\D]+(\d+)[\D]*?([\d.]+|$)/i,hex:/^#?(([\dA-Fa-f]{3,4})|([\dA-Fa-f]{6})|([\dA-Fa-f]{8}))$/i},i=function(t){return t.map(function(t){return/^(|\d+)\.\d+|\d+$/.test(t)?Number(t):void 0})};for(var a in o)if(r=o[a].exec(t))switch(a){case"cmyk":var c=y(i(r),5),s=c[1],u=c[2],l=c[3],p=c[4];if(s>100||u>100||l>100||p>100)break;return{values:[].concat(m(j(s,u,l,p)),[1]),type:a};case"rgba":var h=y(i(r),6),d=h[2],f=h[3],v=h[4],g=h[5],b=void 0===g?1:g;if(d>255||f>255||v>255||b<0||b>1)break;return{values:[].concat(m(O(d,f,v)),[b]),type:a};case"hex":var _=function(t,e){return[t.substring(0,e),t.substring(e,t.length)]},w=y(r,2)[1];3===w.length?w+="F":6===w.length&&(w+="FF");var k=void 0;if(4===w.length){var A=y(_(w,3).map(function(t){return t+t}),2);w=A[0],k=A[1]}else if(8===w.length){var C=y(_(w,6),2);w=C[0],k=C[1]}return k=parseInt(k,16)/255,{values:[].concat(m(x(w)),[k]),type:a};case"hsla":var S=y(i(r),6),H=S[2],B=S[3],L=S[4],P=S[5],R=void 0===P?1:P;if(H>360||B>100||L>100||R<0||R>1)break;return{values:[].concat(m(E(H,B,L)),[R]),type:a};case"hsva":var D=y(i(r),6),T=D[2],F=D[3],M=D[4],N=D[5],X=void 0===N?1:N;if(T>360||F>100||M>100||X<0||X>1)break;return{values:[T,F,M,X],type:a}}return{values:null,type:null}}function B(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,i=Math.ceil,a={h:t,s:e,v:n,a:r,toHSVA:function(){var t=[a.h,a.s,a.v],e=t.map(i);return t.push(a.a),t.toString=function(){return"hsva(".concat(e[0],", ").concat(e[1],"%, ").concat(e[2],"%, ").concat(a.a.toFixed(1),")")},t},toHSLA:function(){var t=S(a.h,a.s,a.v),e=t.map(i);return t.push(a.a),t.toString=function(){return"hsla(".concat(e[0],", ").concat(e[1],"%, ").concat(e[2],"%, ").concat(a.a.toFixed(1),")")},t},toRGBA:function(){var t=k(a.h,a.s,a.v),e=t.map(i);return t.push(a.a),t.toString=function(){return"rgba(".concat(e[0],", ").concat(e[1],", ").concat(e[2],", ").concat(a.a.toFixed(1),")")},t},toCMYK:function(){var t=C(a.h,a.s,a.v),e=t.map(i);return t.toString=function(){return"cmyk(".concat(e[0],"%, ").concat(e[1],"%, ").concat(e[2],"%, ").concat(e[3],"%)")},t},toHEXA:function(){var t=A.apply(o,[a.h,a.s,a.v]);return t.toString=function(){var e=a.a>=1?"":v(Number((255*a.a).toFixed(0)).toString(16).toUpperCase(),2,"0");return"#".concat(t.join("").toUpperCase()+e)},t},clone:function(){return B(a.h,a.s,a.v,a.a)}};return a.toHEX=a.toHEXA,a}function L(t){var e={options:Object.assign({lockX:!1,lockY:!1,onchange:function(){return 0}},t),_tapstart:function(t){c(document,["mouseup","touchend","touchcancel"],e._tapstop),c(document,["mousemove","touchmove"],e._tapmove),t.preventDefault(),e._tapmove(t)},_tapmove:function(t){var n=e.options,r=e.cache,o=n.element,i=e.options.wrapper.getBoundingClientRect(),a=0,c=0;if(t){var s=t&&t.touches&&t.touches[0];a=t?(s||t).clientX:0,c=t?(s||t).clientY:0,ai.left+i.width&&(a=i.left+i.width),ci.top+i.height&&(c=i.top+i.height),a-=i.left,c-=i.top}else r&&(a=r.x*i.width,c=r.y*i.height);n.lockX||(o.style.left="calc(".concat(a/i.width*100,"% - ").concat(o.offsetWidth/2,"px)")),n.lockY||(o.style.top="calc(".concat(c/i.height*100,"% - ").concat(o.offsetWidth/2,"px)")),e.cache={x:a/i.width,y:c/i.height},n.onchange(a,c)},_tapstop:function(){s(document,["mouseup","touchend","touchcancel"],e._tapstop),s(document,["mousemove","touchmove"],e._tapmove)},trigger:function(){e._tapmove()},update:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=e.options.wrapper.getBoundingClientRect();e._tapmove({clientX:r.left+t,clientY:r.top+n})},destroy:function(){var t=e.options,n=e._tapstart;s([t.wrapper,t.element],"mousedown",n),s([t.wrapper,t.element],"touchstart",n,{passive:!1})}},n=e.options,r=e._tapstart;return c([n.wrapper,n.element],"mousedown",r),c([n.wrapper,n.element],"touchstart",r,{passive:!1}),e}function P(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e0&&void 0!==arguments[0]?arguments[0]:{};t=Object.assign({onchange:function(){return 0},className:"",elements:[]},t);var e=c(t.elements,"click",function(e){t.elements.forEach(function(n){return n.classList[e.target===n?"add":"remove"](t.className)}),t.onchange(e)});return{destroy:function(){return s.apply(r,P(e))}}}function D(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);ec?p.left:h<0?p.right:h,Object.assign(e.style,{left:"".concat(n,"px"),top:"".concat(r,"px")})}}),this.options=e=Object.assign({useAsButton:!1,disabled:!1,comparison:!0,components:{interaction:{}},strings:{},swatches:null,inline:!1,default:"fff",defaultRepresentation:null,position:"middle",adjustableNumbers:!0,showAlways:!1,closeWithKey:"Escape"},e);var i=e,a=i.swatches,c=i.inline,s=i.components;s.interaction||(s.interaction={});var u=s.preview,l=s.opacity,p=s.hue,h=s.palette;s.palette=h||u||l||p,c&&(e.showAlways=!0),this._preBuild(),this._buildComponents(),this._bindEvents(),this._finalBuild(),a&&a.length&&a.forEach(function(t){return o.addSwatch(t)});var d=this._root.button;requestAnimationFrame(function t(){if(null===d.offsetParent&&d!==document.body)return requestAnimationFrame(t.bind(this));this.setColor(e.default),this._rePositioningPicker(),e.defaultRepresentation&&(this._representation=e.defaultRepresentation,this.setColorRepresentation(this._representation)),e.showAlways&&this.show(),this._initializingActive=!1,this._emit("init")}.bind(this))}var e,n,o;return e=t,(n=[{key:"_preBuild",value:function(){var t,e,n,r,o,i,a,c,s=this.options;"string"==typeof s.el&&(s.el=s.el.split(/>>/g).reduce(function(t,e,n,r){return t=t.querySelector(e),n\n \n '.concat(r?"":'','\n\n
\n
\n
\n \n
\n
\n\n
\n
\n
\n
\n\n
\n
\n
\n
\n\n
\n
\n
\n
\n
\n\n
\n\n
\n \n\n \n \n \n \n \n\n \n \n
\n
\n \n ")),(c=a.interaction).options.find(function(t){return!t.hidden&&!t.classList.add("active")}),c.type=function(){return c.options.find(function(t){return t.classList.contains("active")})},a),s.useAsButton&&(this._root.button=s.el),document.body.appendChild(this._root.root)}},{key:"_finalBuild",value:function(){var t=this.options,e=this._root;if(document.body.removeChild(e.root),t.inline){var n=t.el.parentElement;n.lastChild===t.el?n.appendChild(e.app):n.insertBefore(e.app,t.el.nextSibling)}else document.body.appendChild(e.app);t.useAsButton||t.el.parentNode.replaceChild(e.root,t.el),t.disabled&&this.disable(),t.comparison||(e.button.style.transition="none",t.useAsButton||(e.preview.lastColor.style.transition="none")),this.hide()}},{key:"_buildComponents",value:function(){var t=this,e=this.options.components,n={palette:L({element:t._root.palette.picker,wrapper:t._root.palette.palette,onchange:function(n,r){if(e.palette){var o=t._color,i=t._root,a=t.options;o.s=n/this.wrapper.offsetWidth*100,o.v=100-r/this.wrapper.offsetHeight*100,o.v<0&&(o.v=0);var c=o.toRGBA().toString();this.element.style.background=c,this.wrapper.style.background="\n linear-gradient(to top, rgba(0, 0, 0, ".concat(o.a,"), transparent), \n linear-gradient(to left, hsla(").concat(o.h,", 100%, 50%, ").concat(o.a,"), rgba(255, 255, 255, ").concat(o.a,"))\n "),a.comparison||(i.button.style.color=c,a.useAsButton||(i.preview.lastColor.style.color=c)),i.preview.currentColor.style.color=c,t._recalc&&t._updateOutput(),i.button.classList.remove("clear")}}}),hue:L({lockX:!0,element:t._root.hue.picker,wrapper:t._root.hue.slider,onchange:function(r,o){e.hue&&e.palette&&(t._color.h=o/this.wrapper.offsetHeight*360,this.element.style.backgroundColor="hsl(".concat(t._color.h,", 100%, 50%)"),n.palette.trigger())}}),opacity:L({lockX:!0,element:t._root.opacity.picker,wrapper:t._root.opacity.slider,onchange:function(n,r){e.opacity&&e.palette&&(t._color.a=Math.round(r/this.wrapper.offsetHeight*100)/100,this.element.style.background="rgba(0, 0, 0, ".concat(t._color.a,")"),t.components.palette.trigger())}}),selectable:R({elements:t._root.interaction.options,className:"active",onchange:function(e){t._representation=e.target.getAttribute("data-type").toUpperCase(),t._updateOutput()}})};this.components=n}},{key:"_bindEvents",value:function(){var t,e=this,n=this._root,r=this.options,o=[c(n.interaction.clear,"click",function(){return e._clearColor()}),c(n.preview.lastColor,"click",function(){return e.setHSVA.apply(e,D(e._lastColor.toHSVA()))}),c(n.interaction.save,"click",function(){!e.applyColor()&&!r.showAlways&&e.hide()}),c(n.interaction.result,["keyup","input"],function(t){e._recalc=!1,e.setColor(t.target.value,!0)&&!e._initializingActive&&e._emit("change",e._color),t.stopImmediatePropagation()}),c([n.palette.palette,n.palette.picker,n.hue.slider,n.hue.picker,n.opacity.slider,n.opacity.picker],["mousedown","touchstart"],function(){return e._recalc=!0})];if(!r.showAlways){var i=r.closeWithKey;o.push(c(n.button,"click",function(){return e.isOpen()?e.hide():e.show()}),c(document,"keyup",function(t){return e.isOpen()&&(t.key===i||t.code===i)&&e.hide()}),c(document,["touchstart","mousedown"],function(t){e.isOpen()&&!d(t).some(function(t){return t===n.app||t===n.button})&&e.hide()},{capture:!0}))}(r.adjustableNumbers&&f(n.interaction.result,!1),r.inline)||o.push(c(window,["scroll","wheel","resize"],function(){e.isOpen()&&(e.hide(),t&&clearTimeout(t),t=setTimeout(function(){return e.show()},250))}));this._eventBindings=o}},{key:"_updateOutput",value:function(){if(this._root.interaction.type()){var t="to".concat(this._root.interaction.type().getAttribute("data-type"));this._root.interaction.result.value="function"==typeof this._color[t]?this._color[t]().toString():""}this._initializingActive||this._emit("change",this._color)}},{key:"_clearColor",value:function(){var t=this._root,e=this.options;e.useAsButton||(t.button.style.color="rgba(0, 0, 0, 0.15)"),t.button.classList.add("clear"),e.showAlways||this.hide(),this._initializingActive||this._emit("save",null)}},{key:"_emit",value:function(t){for(var e=this,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o'));return o.swatches.appendChild(a),r.push({element:a,hsvaColorObject:i}),this._eventBindings.push(c(a,"click",function(){e.setHSVA.apply(e,D(i.toHSVA()).concat([!0])),e._emit("swatchselect",i)})),!0}return!1}},{key:"removeSwatch",value:function(t){if("number"==typeof t){var e=this._swatchColors[t];if(e){var n=e.element;return this._root.swatches.removeChild(n),this._swatchColors.splice(t,1),!0}}return!1}},{key:"applyColor",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=this._root,n=e.preview,r=e.button,o=this._color.toRGBA().toString();n.lastColor.style.color=o,this.options.useAsButton||(r.style.color=o),r.classList.remove("clear"),this._lastColor=this._color.clone(),this._initializingActive||t||this._emit("save",this._color)}},{key:"destroy",value:function(){var t=this;this._eventBindings.forEach(function(t){return s.apply(r,D(t))}),Object.keys(this.components).forEach(function(e){return t.components[e].destroy()})}},{key:"destroyAndRemove",value:function(){this.destroy();var t=this._root.root;t.parentElement.removeChild(t);var e=this._root.app;e.parentElement.removeChild(e);var n=this;Object.keys(n).forEach(function(t){return n[t]=null})}},{key:"hide",value:function(){return this._root.app.classList.remove("visible"),this}},{key:"show",value:function(){if(!this.options.disabled)return this._root.app.classList.add("visible"),this._rePositioningPicker(),this}},{key:"isOpen",value:function(){return this._root.app.classList.contains("visible")}},{key:"setHSVA",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:360,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,o=arguments.length>4&&void 0!==arguments[4]&&arguments[4],i=this._recalc;if(this._recalc=!1,t<0||t>360||e<0||e>100||n<0||n>100||r<0||r>1)return!1;var a=this.components,c=a.hue,s=a.opacity,u=a.palette,l=c.options.wrapper.offsetHeight*(t/360);c.update(0,l);var p=s.options.wrapper.offsetHeight*r;s.update(0,p);var h=u.options.wrapper,d=h.offsetWidth*(e/100),f=h.offsetHeight*(1-n/100);return u.update(d,f),this._color=B(t,e,n,r),this._recalc=i,this._recalc&&this._updateOutput(),o||this.applyColor(),!0}},{key:"setColor",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(null===t)return this._clearColor(),!0;var n=H(t),r=n.values,o=n.type;if(r){var i=o.toUpperCase(),a=this._root.interaction.options,c=a.find(function(t){return t.getAttribute("data-type").startsWith(i)});if(c&&!c.hidden){var s=!0,u=!1,l=void 0;try{for(var p,h=a[Symbol.iterator]();!(s=(p=h.next()).done);s=!0){var d=p.value;d.classList[d===c?"add":"remove"]("active")}}catch(t){u=!0,l=t}finally{try{s||null==h.return||h.return()}finally{if(u)throw l}}}return this.setHSVA.apply(this,D(r).concat([e]))}}},{key:"setColorRepresentation",value:function(t){return t=t.toUpperCase(),!!this._root.interaction.options.find(function(e){return e.getAttribute("data-type").startsWith(t)&&!e.click()})}},{key:"getColorRepresentation",value:function(){return this._representation}},{key:"getColor",value:function(){return this._color}},{key:"getRoot",value:function(){return this._root}},{key:"disable",value:function(){return this.hide(),this.options.disabled=!0,this._root.button.classList.add("disabled"),this}},{key:"enable",value:function(){return this.options.disabled=!1,this._root.button.classList.remove("disabled"),this}}])&&T(e.prototype,n),o&&T(e,o),t}();M.utils={once:a,on:c,off:s,eventPath:d,createElementFromString:l,adjustableInputNumbers:f,removeAttribute:p,createFromTemplate:h},M.create=function(t){return new M(t)},M.version="0.5.0";e.default=M}]).default}); //# sourceMappingURL=pickr.es5.min.js.map \ No newline at end of file diff --git a/dist/pickr.es5.min.js.map b/dist/pickr.es5.min.js.map index 05f6f255..7e2f758f 100644 --- a/dist/pickr.es5.min.js.map +++ b/dist/pickr.es5.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap","webpack:///./src/js/lib/utils.js","webpack:///./src/js/lib/color.js","webpack:///./src/js/lib/hsvacolor.js","webpack:///./src/js/helper/moveable.js","webpack:///./src/js/helper/selectable.js","webpack:///./src/js/pickr.js"],"names":["root","factory","exports","module","define","amd","window","installedModules","__webpack_require__","moduleId","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","once","element","event","fn","options","on","helper","apply","this","arguments","removeEventListener","eventListener","off","method","elements","events","length","undefined","HTMLCollection","NodeList","Array","from","isArray","forEach","el","ev","_objectSpread","capture","slice","createElementFromString","html","div","document","createElement","innerHTML","trim","firstElementChild","removeAttribute","getAttribute","createFromTemplate","str","resolve","base","con","children","subtree","_i","_children","child","arr","push","eventPath","evt","path","composedPath","target","parentElement","adjustableInputNumbers","negative","isNumChar","handleScroll","e","val","selectionStart","numStart","num","isNaN","isFinite","mul","deltaY","inc","ctrlKey","newNum","Number","newStr","substr","substring","curPos","String","focus","setSelectionRange","preventDefault","dispatchEvent","Event","passive","padStart","string","maxLength","fillString","repeat","min","Math","max","floor","round","hsvToRgb","h","v","f","q","mod","hsvToHex","map","toString","hsvToCmyk","k","rgb","g","b","hsvToHsl","rgbToHsv","minVal","maxVal","delta","dr","dg","db","cmykToHsv","y","_toConsumableArray","hslToHsv","hexToHsv","hex","match","parseInt","parseToHSV","ctx","getContext","fillStyle","regex","cmyk","rgba","hsla","hsva","numarize","array","test","type","exec","_numarize2","_slicedToArray","values","concat","_numarize4","_numarize4$","a","splitAt","alpha","_splitAt$map2","_splitAt2","_numarize6","_numarize6$","_numarize8","_numarize8$","HSVaColor","ceil","that","toHSVA","rhsva","toFixed","toHSLA","Color","rhsla","toRGBA","rrgba","toCMYK","rcmyk","toHEXA","toUpperCase","join","clone","toHEX","Moveable","opt","assign","lockX","lockY","onchange","_tapstart","_","_tapstop","_tapmove","cache","wrapper","getBoundingClientRect","x","touch","touches","clientX","clientY","left","width","top","height","style","offsetWidth","trigger","update","wrapperRect","destroy","Selectable","className","onTap","classList","selectable_toConsumableArray","Pickr","_this","_classCallCheck","pickr_defineProperty","swatchselect","change","save","init","inline","_this$_root","_root","app","button","_window","innerWidth","innerHeight","bb","ab","bottom","pos","middle","right","wantedLeft","position","useAsButton","disabled","comparison","components","interaction","strings","swatches","default","defaultRepresentation","adjustableNumbers","showAlways","closeWithKey","_opt","preview","opacity","hue","palette","_preBuild","_buildComponents","_bindEvents","_finalBuild","color","addSwatch","requestAnimationFrame","cb","offsetParent","body","setColor","_rePositioningPicker","_representation","setColorRepresentation","show","_initializingActive","_emit","hidden","int","split","reduce","pv","cv","ci","querySelector","shadowRoot","keys","input","clear","find","add","contains","appendChild","removeChild","lastChild","insertBefore","nextSibling","parentNode","replaceChild","disable","transition","lastColor","hide","inst","comp","picker","_color","offsetHeight","cssRGBaString","background","currentColor","_recalc","_updateOutput","remove","slider","backgroundColor","selectable","updateTimeout","_this2","eventBindings","_clearColor","setHSVA","pickr_toConsumableArray","_lastColor","applyColor","result","stopImmediatePropagation","ck","isOpen","code","some","clearTimeout","setTimeout","_eventBindings","_this3","_len","args","_key","_eventListener","callBacks","index","indexOf","splice","_this4","_swatchColors","hsvaColorObject","swatchColor","silent","_this$_root2","_this5","pickr","recalc","_this$components","hueY","opacityY","pickerWrapper","pickerX","pickerY","_Color$parseToHSV2","utype","startsWith","_iteratorNormalCompletion","_didIteratorError","_iteratorError","_step","_iterator","iterator","next","done","err","return","click","utils","version"],"mappings":";CAAA,SAAAA,EAAAC,GACA,iBAAAC,SAAA,iBAAAC,OACAA,OAAAD,QAAAD,IACA,mBAAAG,eAAAC,IACAD,OA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.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"Pickr\"] = factory();\n\telse\n\t\troot[\"Pickr\"] = factory();\n})(window, function() {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 1);\n","/**\n * Add an eventlistener which will be fired only once.\n *\n * @param element Target element\n * @param event Event name\n * @param fn Callback\n * @param options Optional options\n * @return Array passed arguments\n */\nexport const once = (element, event, fn, options) => on(element, event, function helper() {\n fn.apply(this, arguments);\n this.removeEventListener(event, helper);\n}, options);\n\n/**\n * Add event(s) to element(s).\n * @param elements DOM-Elements\n * @param events Event names\n * @param fn Callback\n * @param options Optional options\n * @return Array passed arguments\n */\nexport const on = eventListener.bind(null, 'addEventListener');\n\n/**\n * Remove event(s) from element(s).\n * @param elements DOM-Elements\n * @param events Event names\n * @param fn Callback\n * @param options Optional options\n * @return Array passed arguments\n */\nexport const off = eventListener.bind(null, 'removeEventListener');\n\nfunction eventListener(method, elements, events, fn, options = {}) {\n\n // Normalize array\n if (elements instanceof HTMLCollection || elements instanceof NodeList) {\n elements = Array.from(elements);\n } else if (!Array.isArray(elements)) {\n elements = [elements];\n }\n\n if (!Array.isArray(events)) {\n events = [events];\n }\n\n elements.forEach(el =>\n events.forEach(ev =>\n el[method](ev, fn, {capture: false, ...options})\n )\n );\n\n return Array.prototype.slice.call(arguments, 1);\n}\n\n/**\n * Creates an DOM-Element out of a string (Single element).\n * @param html HTML representing a single element\n * @returns {Element | null} The element.\n */\nexport function createElementFromString(html) {\n const div = document.createElement('div');\n div.innerHTML = html.trim();\n return div.firstElementChild;\n}\n\n/**\n * Removes an attribute from a HTMLElement and returns the value.\n * @param el\n * @param name\n * @return {string}\n */\nexport function removeAttribute(el, name) {\n const value = el.getAttribute(name);\n el.removeAttribute(name);\n return value;\n}\n\n/**\n * Creates a new html element, every element which has\n * a 'data-key' attribute will be saved in a object (which will be returned)\n * where the value of 'data-key' ist the object-key and the value the HTMLElement.\n *\n * It's possible to create a hierarchy if you add a 'data-con' attribute. Every\n * sibling will be added to the object which will get the name from the 'data-con' attribute.\n *\n * If you want to create an Array out of multiple elements, you can use the 'data-arr' attribute,\n * the value defines the key and all elements, which has the same parent and the same 'data-arr' attribute,\n * would be added to it.\n *\n * @param str - The HTML String.\n */\nexport function createFromTemplate(str) {\n\n // Recursive function to resolve template\n function resolve(element, base = {}) {\n\n // Check key and container attribute\n const con = removeAttribute(element, 'data-con');\n const key = removeAttribute(element, 'data-key');\n\n // Check and save element\n if (key) {\n base[key] = element;\n }\n\n // Check all children\n const children = Array.from(element.children);\n const subtree = con ? (base[con] = {}) : base;\n for (let child of children) {\n\n // Check if element should be saved as array\n const arr = removeAttribute(child, 'data-arr');\n if (arr) {\n\n // Check if there is already an array and add element\n (subtree[arr] || (subtree[arr] = [])).push(child);\n } else {\n resolve(child, subtree);\n }\n }\n\n return base;\n }\n\n return resolve(createElementFromString(str));\n}\n\n/**\n * Polyfill for safari & firefox for the eventPath event property.\n * @param evt The event object.\n * @return [String] event path.\n */\nexport function eventPath(evt) {\n let path = evt.path || (evt.composedPath && evt.composedPath());\n if (path) return path;\n\n let el = evt.target.parentElement;\n path = [evt.target, el];\n while (el = el.parentElement) path.push(el);\n\n path.push(document, window);\n return path;\n}\n\n/**\n * Creates the ability to change numbers in an input field with the scroll-wheel.\n * @param el\n * @param negative\n */\nexport function adjustableInputNumbers(el, negative = true) {\n\n // Check if a char represents a number\n const isNumChar = c => (c >= '0' && c <= '9') || c === '-' || c === '.';\n\n function handleScroll(e) {\n const val = el.value;\n const off = el.selectionStart;\n let numStart = off;\n let num = ''; // Will be the number as string\n\n // Look back\n for (let i = off - 1; i > 0 && isNumChar(val[i]); i--) {\n num = val[i] + num;\n numStart--; // Find start of number\n }\n\n // Look forward\n for (let i = off, n = val.length; i < n && isNumChar(val[i]); i++) {\n num += val[i];\n }\n\n // Check if number is valid\n if (num.length > 0 && !isNaN(num) && isFinite(num)) {\n\n const mul = e.deltaY < 0 ? 1 : -1;\n const inc = e.ctrlKey ? mul * 5 : mul;\n let newNum = Number(num) + inc;\n\n if (!negative && newNum < 0) {\n newNum = 0;\n }\n\n const newStr = val.substr(0, numStart) + newNum + val.substring(numStart + num.length, val.length);\n const curPos = numStart + String(newNum).length;\n\n // Update value and set cursor\n el.value = newStr;\n el.focus();\n el.setSelectionRange(curPos, curPos);\n }\n\n // Prevent default\n e.preventDefault();\n\n // Trigger input event\n el.dispatchEvent(new Event('input'));\n }\n\n // Bind events\n on(el, 'focus', () => on(window, 'wheel', handleScroll, {passive: false}));\n on(el, 'blur', () => off(window, 'wheel', handleScroll));\n}\n\n/**\n * Cross browser padStart implementation\n * @param string\n * @param maxLength\n * @param fillString\n * @returns {string}\n */\nexport function padStart(string, maxLength, fillString = ' ') {\n maxLength = maxLength - string.length;\n\n if (maxLength <= 0 || !fillString.length) {\n return String(string);\n } else {\n\n if (maxLength > fillString.length) {\n fillString += fillString.repeat(maxLength / fillString.length);\n }\n\n return fillString.slice(0, maxLength) + String(string);\n }\n}\n","import {padStart} from '../lib/utils';\n\n// Shorthands\nconst {min, max, floor, round} = Math;\n\n/**\n * Tries to convert a color name to rgb/a hex representation\n * @param name\n * @returns {string | CanvasGradient | CanvasPattern}\n */\nfunction standardizeColor(name) {\n const ctx = document.createElement('canvas').getContext('2d');\n ctx.fillStyle = name;\n return ctx.fillStyle;\n}\n\n/**\n * Convert HSV spectrum to RGB.\n * @param h Hue\n * @param s Saturation\n * @param v Value\n * @returns {number[]} Array with rgb values.\n */\nexport function hsvToRgb(h, s, v) {\n h = (h / 360) * 6;\n s /= 100;\n v /= 100;\n\n let i = floor(h);\n\n let f = h - i;\n let p = v * (1 - s);\n let q = v * (1 - f * s);\n let t = v * (1 - (1 - f) * s);\n\n let mod = i % 6;\n let r = [v, q, p, p, t, v][mod];\n let g = [t, v, v, q, p, p][mod];\n let b = [p, p, t, v, v, q][mod];\n\n return [\n r * 255,\n g * 255,\n b * 255\n ];\n}\n\n/**\n * Convert HSV spectrum to Hex.\n * @param h Hue\n * @param s Saturation\n * @param v Value\n * @returns {string[]} Hex values\n */\nexport function hsvToHex(h, s, v) {\n return hsvToRgb(h, s, v).map(v =>\n padStart(round(v).toString(16), 2, '0')\n );\n}\n\n/**\n * Convert HSV spectrum to CMYK.\n * @param h Hue\n * @param s Saturation\n * @param v Value\n * @returns {number[]} CMYK values\n */\nexport function hsvToCmyk(h, s, v) {\n const rgb = hsvToRgb(h, s, v);\n const r = rgb[0] / 255;\n const g = rgb[1] / 255;\n const b = rgb[2] / 255;\n\n let k, c, m, y;\n\n k = min(1 - r, 1 - g, 1 - b);\n\n c = k === 1 ? 0 : (1 - r - k) / (1 - k);\n m = k === 1 ? 0 : (1 - g - k) / (1 - k);\n y = k === 1 ? 0 : (1 - b - k) / (1 - k);\n\n return [\n c * 100,\n m * 100,\n y * 100,\n k * 100\n ];\n}\n\n/**\n * Convert HSV spectrum to HSL.\n * @param h Hue\n * @param s Saturation\n * @param v Value\n * @returns {number[]} HSL values\n */\nexport function hsvToHsl(h, s, v) {\n s /= 100, v /= 100;\n\n let l = (2 - s) * v / 2;\n\n if (l !== 0) {\n if (l === 1) {\n s = 0;\n } else if (l < 0.5) {\n s = s * v / (l * 2);\n } else {\n s = s * v / (2 - l * 2);\n }\n }\n\n return [\n h,\n s * 100,\n l * 100\n ];\n}\n\n/**\n * Convert RGB to HSV.\n * @param r Red\n * @param g Green\n * @param b Blue\n * @return {number[]} HSV values.\n */\nfunction rgbToHsv(r, g, b) {\n r /= 255, g /= 255, b /= 255;\n\n let h, s, v;\n const minVal = min(r, g, b);\n const maxVal = max(r, g, b);\n const delta = maxVal - minVal;\n\n v = maxVal;\n if (delta === 0) {\n h = s = 0;\n } else {\n s = delta / maxVal;\n let dr = (((maxVal - r) / 6) + (delta / 2)) / delta;\n let dg = (((maxVal - g) / 6) + (delta / 2)) / delta;\n let db = (((maxVal - b) / 6) + (delta / 2)) / delta;\n\n if (r === maxVal) {\n h = db - dg;\n } else if (g === maxVal) {\n h = (1 / 3) + dr - db;\n } else if (b === maxVal) {\n h = (2 / 3) + dg - dr;\n }\n\n if (h < 0) {\n h += 1;\n } else if (h > 1) {\n h -= 1;\n }\n }\n\n return [\n h * 360,\n s * 100,\n v * 100\n ];\n}\n\n/**\n * Convert CMYK to HSV.\n * @param c Cyan\n * @param m Magenta\n * @param y Yellow\n * @param k Key (Black)\n * @return {number[]} HSV values.\n */\nfunction cmykToHsv(c, m, y, k) {\n c /= 100, m /= 100, y /= 100, k /= 100;\n\n const r = (1 - min(1, c * (1 - k) + k)) * 255;\n const g = (1 - min(1, m * (1 - k) + k)) * 255;\n const b = (1 - min(1, y * (1 - k) + k)) * 255;\n\n return [...rgbToHsv(r, g, b)];\n}\n\n/**\n * Convert HSL to HSV.\n * @param h Hue\n * @param s Saturation\n * @param l Lightness\n * @return {number[]} HSV values.\n */\nfunction hslToHsv(h, s, l) {\n s /= 100, l /= 100;\n s *= l < 0.5 ? l : 1 - l;\n\n let ns = (2 * s / (l + s)) * 100;\n let v = (l + s) * 100;\n return [h, ns, v];\n}\n\n/**\n * Convert HEX to HSV.\n * @param hex Hexadecimal string of rgb colors, can have length 3 or 6.\n * @return {number[]} HSV values.\n */\nfunction hexToHsv(hex) {\n return rgbToHsv(...hex.match(/.{2}/g).map(v => parseInt(v, 16)));\n}\n\n/**\n * Try's to parse a string which represents a color to a HSV array.\n * Current supported types are cmyk, rgba, hsla and hexadecimal.\n * @param str\n * @return {*}\n */\nexport function parseToHSV(str) {\n\n // Check if string is a color-name\n str = str.match(/^[a-zA-Z]+$/) ? standardizeColor(str) : str;\n\n // Regular expressions to match different types of color represention\n const regex = {\n cmyk: /^cmyk[\\D]+(\\d+)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]+(\\d+)/i,\n rgba: /^(rgb|rgba)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]*?([\\d.]+|$)/i,\n hsla: /^(hsl|hsla)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]*?([\\d.]+|$)/i,\n hsva: /^(hsv|hsva)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]*?([\\d.]+|$)/i,\n hex: /^#?(([\\dA-Fa-f]{3,4})|([\\dA-Fa-f]{6})|([\\dA-Fa-f]{8}))$/i\n };\n\n /**\n * Takes an Array of any type, convert strings which represents\n * a number to a number an anything else to undefined.\n * @param array\n * @return {*}\n */\n const numarize = array => array.map(v => /^(|\\d+)\\.\\d+|\\d+$/.test(v) ? Number(v) : undefined);\n\n let match;\n for (const type in regex) {\n\n // Check if current scheme passed\n if (!(match = regex[type].exec(str)))\n continue;\n\n // Try to convert\n switch (type) {\n case 'cmyk': {\n let [, c, m, y, k] = numarize(match);\n\n if (c > 100 || m > 100 || y > 100 || k > 100)\n break;\n\n return {values: [...cmykToHsv(c, m, y, k), 1], type};\n }\n case 'rgba': {\n let [, , r, g, b, a = 1] = numarize(match);\n\n if (r > 255 || g > 255 || b > 255 || a < 0 || a > 1)\n break;\n\n return {values: [...rgbToHsv(r, g, b), a], type};\n }\n case 'hex': {\n const splitAt = (s, i) => [s.substring(0, i), s.substring(i, s.length)];\n let [, hex] = match;\n\n // Fill up opacity if not declared\n if (hex.length === 3) {\n hex += 'F';\n } else if (hex.length === 6) {\n hex += 'FF';\n }\n\n let alpha;\n if (hex.length === 4) {\n [hex, alpha] = splitAt(hex, 3).map(v => v + v);\n } else if (hex.length === 8) {\n [hex, alpha] = splitAt(hex, 6);\n }\n\n // Convert 0 - 255 to 0 - 1 for opacity\n alpha = parseInt(alpha, 16) / 255;\n return {values: [...hexToHsv(hex), alpha], type};\n }\n case 'hsla': {\n let [, , h, s, l, a = 1] = numarize(match);\n\n if (h > 360 || s > 100 || l > 100 || a < 0 || a > 1)\n break;\n\n return {values: [...hslToHsv(h, s, l), a], type};\n }\n case 'hsva': {\n let [, , h, s, v, a = 1] = numarize(match);\n\n if (h > 360 || s > 100 || v > 100 || a < 0 || a > 1)\n break;\n\n return {values: [h, s, v, a], type};\n }\n }\n }\n\n return {values: null, type: null};\n}\n","import {padStart} from '../lib/utils';\nimport * as Color from './color';\n\n/**\n * Simple class which holds the properties\n * of the color represention model hsla (hue saturation lightness alpha)\n */\nexport function HSVaColor(h = 0, s = 0, v = 0, a = 1) {\n\n const ceil = Math.ceil;\n const that = {\n h, s, v, a,\n\n toHSVA() {\n const hsva = [that.h, that.s, that.v];\n const rhsva = hsva.map(ceil);\n\n hsva.push(that.a);\n hsva.toString = () => `hsva(${rhsva[0]}, ${rhsva[1]}%, ${rhsva[2]}%, ${that.a.toFixed(1)})`;\n return hsva;\n },\n\n toHSLA() {\n const hsla = Color.hsvToHsl(that.h, that.s, that.v);\n const rhsla = hsla.map(ceil);\n\n hsla.push(that.a);\n hsla.toString = () => `hsla(${rhsla[0]}, ${rhsla[1]}%, ${rhsla[2]}%, ${that.a.toFixed(1)})`;\n return hsla;\n },\n\n toRGBA() {\n const rgba = Color.hsvToRgb(that.h, that.s, that.v);\n const rrgba = rgba.map(ceil);\n\n rgba.push(that.a);\n rgba.toString = () => `rgba(${rrgba[0]}, ${rrgba[1]}, ${rrgba[2]}, ${that.a.toFixed(1)})`;\n return rgba;\n },\n\n toCMYK() {\n const cmyk = Color.hsvToCmyk(that.h, that.s, that.v);\n const rcmyk = cmyk.map(ceil);\n\n cmyk.toString = () => `cmyk(${rcmyk[0]}%, ${rcmyk[1]}%, ${rcmyk[2]}%, ${rcmyk[3]}%)`;\n return cmyk;\n },\n\n toHEXA() {\n const hex = Color.hsvToHex(...[that.h, that.s, that.v]);\n\n hex.toString = () => {\n\n // Check if alpha channel make sense, convert it to 255 number space, convert\n // to hex and pad it with zeros if needet.\n const alpha = that.a >= 1 ? '' : padStart(Number((that.a * 255).toFixed(0))\n .toString(16)\n .toUpperCase(), 2, '0');\n\n return `#${hex.join('').toUpperCase() + alpha}`;\n };\n\n return hex;\n },\n\n clone() {\n return HSVaColor(that.h, that.s, that.v, that.a);\n }\n };\n\n // TODO: Remove in 0.5.0\n that.toHEX = that.toHEXA;\n return that;\n}\n","import * as _ from './../lib/utils';\r\n\r\nexport default function Moveable(opt) {\r\n\r\n const that = {\r\n\r\n // Assign default values\r\n options: Object.assign({\r\n lockX: false,\r\n lockY: false,\r\n onchange: () => 0\r\n }, opt),\r\n\r\n _tapstart(evt) {\r\n _.on(document, ['mouseup', 'touchend', 'touchcancel'], that._tapstop);\r\n _.on(document, ['mousemove', 'touchmove'], that._tapmove);\r\n\r\n // Prevent default touch event\r\n evt.preventDefault();\r\n\r\n // Trigger\r\n that._tapmove(evt);\r\n },\r\n\r\n _tapmove(evt) {\r\n const {options, cache} = that;\r\n const {element} = options;\r\n const b = that.options.wrapper.getBoundingClientRect();\r\n\r\n let x = 0, y = 0;\r\n if (evt) {\r\n const touch = evt && evt.touches && evt.touches[0];\r\n x = evt ? (touch || evt).clientX : 0;\r\n y = evt ? (touch || evt).clientY : 0;\r\n\r\n // Reset to bounds\r\n if (x < b.left) x = b.left;\r\n else if (x > b.left + b.width) x = b.left + b.width;\r\n if (y < b.top) y = b.top;\r\n else if (y > b.top + b.height) y = b.top + b.height;\r\n\r\n // Normalize\r\n x -= b.left;\r\n y -= b.top;\r\n } else if (cache) {\r\n x = cache.x * b.width;\r\n y = cache.y * b.height;\r\n }\r\n\r\n if (!options.lockX) {\r\n element.style.left = `calc(${x / b.width * 100}% - ${element.offsetWidth / 2}px)`;\r\n }\r\n\r\n if (!options.lockY) {\r\n element.style.top = `calc(${y / b.height * 100}% - ${element.offsetWidth / 2}px)`;\r\n }\r\n\r\n that.cache = {x: x / b.width, y: y / b.height};\r\n options.onchange(x, y);\r\n },\r\n\r\n _tapstop() {\r\n _.off(document, ['mouseup', 'touchend', 'touchcancel'], that._tapstop);\r\n _.off(document, ['mousemove', 'touchmove'], that._tapmove);\r\n },\r\n\r\n trigger() {\r\n that._tapmove();\r\n },\r\n\r\n update(x = 0, y = 0) {\r\n const wrapperRect = that.options.wrapper.getBoundingClientRect();\r\n that._tapmove({\r\n clientX: wrapperRect.left + x,\r\n clientY: wrapperRect.top + y\r\n });\r\n },\r\n\r\n destroy() {\r\n const {options, _tapstart} = that;\r\n _.off([options.wrapper, options.element], 'mousedown', _tapstart);\r\n _.off([options.wrapper, options.element], 'touchstart', _tapstart, {\r\n passive: false\r\n });\r\n }\r\n };\r\n\r\n // Initilize\r\n const {options, _tapstart} = that;\r\n _.on([options.wrapper, options.element], 'mousedown', _tapstart);\r\n _.on([options.wrapper, options.element], 'touchstart', _tapstart, {\r\n passive: false\r\n });\r\n\r\n return that;\r\n}\r\n","import * as _ from './../lib/utils';\r\n\r\nexport default function Selectable(opt = {}) {\r\n opt = Object.assign({\r\n onchange: () => 0,\r\n className: '',\r\n elements: []\r\n }, opt);\r\n\r\n const onTap = _.on(opt.elements, 'click', evt => {\r\n opt.elements.forEach(e =>\r\n e.classList[evt.target === e ? 'add' : 'remove'](opt.className)\r\n );\r\n\r\n opt.onchange(evt);\r\n });\r\n\r\n return {\r\n destroy: () => _.off(...onTap)\r\n };\r\n}\r\n","// Import styles\nimport '../scss/pickr.scss';\n\n// Import utils\nimport * as _ from './lib/utils';\nimport * as Color from './lib/color';\n\n// Import classes\nimport {HSVaColor} from './lib/hsvacolor';\nimport Moveable from './helper/moveable';\nimport Selectable from './helper/selectable';\n\nclass Pickr {\n\n // Will be used to prevent specific actions during initilization\n _initializingActive = true;\n\n // Replace element with color picker\n _recalc = true;\n\n // Current and last color for comparison\n _color = HSVaColor();\n _lastColor = HSVaColor();\n _swatchColors = [];\n\n // Evenlistener name: [callbacks]\n _eventListener = {\n 'swatchselect': [],\n 'change': [],\n 'save': [],\n 'init': []\n };\n\n constructor(opt) {\n\n // Assign default values\n this.options = opt = Object.assign({\n useAsButton: false,\n disabled: false,\n comparison: true,\n\n components: {\n interaction: {}\n },\n strings: {},\n\n swatches: null,\n inline: false,\n\n default: 'fff',\n defaultRepresentation: null,\n position: 'middle',\n adjustableNumbers: true,\n showAlways: false,\n\n closeWithKey: 'Escape'\n }, opt);\n const {swatches, inline, components} = opt;\n\n // Check interaction section\n if (!components.interaction) {\n components.interaction = {};\n }\n\n // Overwrite palette if preview, opacity or hue are true\n const {preview, opacity, hue, palette} = components;\n components.palette = palette || preview || opacity || hue;\n\n // Per default enabled if inline\n if (inline) {\n opt.showAlways = true;\n }\n\n // Initialize picker\n this._preBuild();\n this._buildComponents();\n this._bindEvents();\n\n // Finalize build\n this._finalBuild();\n\n // Append pre-defined swatch colors\n if (swatches && swatches.length) {\n swatches.forEach(color => this.addSwatch(color));\n }\n\n // Initilization is finish, pickr is visible and ready for usage\n const {button} = this._root;\n requestAnimationFrame((function cb() {\n\n // offsetParent of body is always 0. So check if it is the body\n if (button.offsetParent === null && button !== document.body) {\n return requestAnimationFrame(cb.bind(this));\n }\n\n // Apply default color\n this.setColor(opt.default);\n this._rePositioningPicker();\n\n // Initialize color representation\n if (opt.defaultRepresentation) {\n this._representation = opt.defaultRepresentation;\n this.setColorRepresentation(this._representation);\n }\n\n // Show pickr if locked\n if (opt.showAlways) {\n this.show();\n }\n\n // Initialization is done - pickr is usable, fire init event\n this._initializingActive = false;\n this._emit('init');\n }).bind(this));\n }\n\n // Does only the absolutly basic thing to initialize the components\n _preBuild() {\n const opt = this.options;\n\n // Check if element is selector\n if (typeof opt.el === 'string') {\n\n // Resolve possible shadow dom access\n opt.el = opt.el.split(/>>/g).reduce((pv, cv, ci, a) => {\n pv = pv.querySelector(cv);\n return ci < a.length - 1 ? pv.shadowRoot : pv;\n }, document);\n }\n\n // Create element and append it to body to\n // prevent initialization errors\n this._root = create(opt);\n\n // Check if a custom button is used\n if (opt.useAsButton) {\n this._root.button = opt.el; // Replace button with customized button\n }\n\n document.body.appendChild(this._root.root);\n }\n\n _finalBuild() {\n const opt = this.options;\n const root = this._root;\n\n // Remove from body\n document.body.removeChild(root.root);\n\n if (opt.inline) {\n const {parentElement} = opt.el;\n\n if (parentElement.lastChild === opt.el) {\n parentElement.appendChild(root.app);\n } else {\n parentElement.insertBefore(root.app, opt.el.nextSibling);\n }\n } else {\n document.body.appendChild(root.app);\n }\n\n // Don't replace the the element if a custom button is used\n if (!opt.useAsButton) {\n\n // Replace element with actual color-picker\n opt.el.parentNode.replaceChild(root.root, opt.el);\n }\n\n // Call disable to also add the disabled class\n if (opt.disabled) {\n this.disable();\n }\n\n // Check if color comparison is disabled, if yes - remove transitions so everything keeps smoothly\n if (!opt.comparison) {\n root.button.style.transition = 'none';\n if (!opt.useAsButton) {\n root.preview.lastColor.style.transition = 'none';\n }\n }\n\n this.hide();\n }\n\n _buildComponents() {\n\n // Instance reference\n const inst = this;\n const comp = this.options.components;\n\n const components = {\n\n palette: Moveable({\n element: inst._root.palette.picker,\n wrapper: inst._root.palette.palette,\n\n onchange(x, y) {\n if (!comp.palette) return;\n const {_color, _root, options} = inst;\n\n // Calculate saturation based on the position\n _color.s = (x / this.wrapper.offsetWidth) * 100;\n\n // Calculate the value\n _color.v = 100 - (y / this.wrapper.offsetHeight) * 100;\n\n // Prevent falling under zero\n _color.v < 0 ? _color.v = 0 : 0;\n\n // Set picker and gradient color\n const cssRGBaString = _color.toRGBA().toString();\n this.element.style.background = cssRGBaString;\n this.wrapper.style.background = `\n linear-gradient(to top, rgba(0, 0, 0, ${_color.a}), transparent), \n linear-gradient(to left, hsla(${_color.h}, 100%, 50%, ${_color.a}), rgba(255, 255, 255, ${_color.a}))\n `;\n\n // Check if color is locked\n if (!options.comparison) {\n _root.button.style.color = cssRGBaString;\n\n if (!options.useAsButton) {\n _root.preview.lastColor.style.color = cssRGBaString;\n }\n }\n\n // Change current color\n _root.preview.currentColor.style.color = cssRGBaString;\n\n // Update the input field only if the user is currently not typing\n if (inst._recalc) {\n inst._updateOutput();\n }\n\n // If the user changes the color, remove the cleared icon\n _root.button.classList.remove('clear');\n }\n }),\n\n hue: Moveable({\n lockX: true,\n element: inst._root.hue.picker,\n wrapper: inst._root.hue.slider,\n\n onchange(x, y) {\n if (!comp.hue || !comp.palette) return;\n\n // Calculate hue\n inst._color.h = (y / this.wrapper.offsetHeight) * 360;\n\n // Update color\n this.element.style.backgroundColor = `hsl(${inst._color.h}, 100%, 50%)`;\n components.palette.trigger();\n }\n }),\n\n opacity: Moveable({\n lockX: true,\n element: inst._root.opacity.picker,\n wrapper: inst._root.opacity.slider,\n\n onchange(x, y) {\n if (!comp.opacity || !comp.palette) return;\n\n // Calculate opacity\n inst._color.a = Math.round(((y / this.wrapper.offsetHeight)) * 1e2) / 100;\n\n // Update color\n this.element.style.background = `rgba(0, 0, 0, ${inst._color.a})`;\n inst.components.palette.trigger();\n }\n }),\n\n selectable: Selectable({\n elements: inst._root.interaction.options,\n className: 'active',\n onchange(e) {\n inst._representation = e.target.getAttribute('data-type').toUpperCase();\n inst._updateOutput();\n }\n })\n };\n\n this.components = components;\n }\n\n _bindEvents() {\n const {_root, options} = this;\n\n const eventBindings = [\n\n // Clear color\n _.on(_root.interaction.clear, 'click', () => this._clearColor()),\n\n // Select last color on click\n _.on(_root.preview.lastColor, 'click', () => this.setHSVA(...this._lastColor.toHSVA())),\n\n // Save color\n _.on(_root.interaction.save, 'click', () => {\n !this.applyColor() && !options.showAlways && this.hide();\n }),\n\n // Detect user input and disable auto-recalculation\n _.on(_root.interaction.result, ['keyup', 'input'], e => {\n this._recalc = false;\n\n // Fire listener if initialization is finish and changed color was valid\n if (this.setColor(e.target.value, true) && !this._initializingActive) {\n this._emit('change', this._color);\n }\n\n e.stopImmediatePropagation();\n }),\n\n // Cancel input detection on color change\n _.on([\n _root.palette.palette,\n _root.palette.picker,\n _root.hue.slider,\n _root.hue.picker,\n _root.opacity.slider,\n _root.opacity.picker\n ], ['mousedown', 'touchstart'], () => this._recalc = true)\n ];\n\n // Provide hiding / showing abilities only if showAlways is false\n if (!options.showAlways) {\n const ck = options.closeWithKey;\n\n eventBindings.push(\n // Save and hide / show picker\n _.on(_root.button, 'click', () => this.isOpen() ? this.hide() : this.show()),\n\n // Close with escape key\n _.on(document, 'keyup', e => this.isOpen() && (e.key === ck || e.code === ck) && this.hide()),\n\n // Cancel selecting if the user taps behind the color picker\n _.on(document, ['touchstart', 'mousedown'], e => {\n if (this.isOpen() && !_.eventPath(e).some(el => el === _root.app || el === _root.button)) {\n this.hide();\n }\n }, {capture: true})\n );\n }\n\n // Make input adjustable if enabled\n if (options.adjustableNumbers) {\n _.adjustableInputNumbers(_root.interaction.result, false);\n }\n\n if (!options.inline) {\n let updateTimeout;\n\n // Re-calc position on window resize, scroll and wheel\n eventBindings.push(_.on(window, ['scroll', 'wheel', 'resize'], () => {\n if (this.isOpen()) {\n this.hide();\n\n if (updateTimeout) {\n clearTimeout(updateTimeout);\n }\n\n updateTimeout = setTimeout(() => this.show(), 250);\n }\n }));\n }\n\n // Save bindings\n this._eventBindings = eventBindings;\n }\n\n _rePositioningPicker = (() => {\n const padding = 8;\n let left, top;\n\n return () => {\n\n // No repositioning needed if inline\n if (this.options.inline) {\n return;\n }\n\n const {app, button} = this._root;\n const {innerWidth, innerHeight} = window;\n const bb = button.getBoundingClientRect();\n const ab = app.getBoundingClientRect();\n\n // Check if picker is cuttet of from the top & bottom\n if (innerHeight - (bb.bottom + ab.height + padding) < 0) {\n top = bb.top - ab.height - padding;\n } else {\n top = bb.bottom + padding;\n }\n\n // Positioning picker on the x-axis\n const pos = {\n left: bb.left + bb.width - ab.width,\n middle: (-ab.width / 2) + (bb.left + bb.width / 2),\n right: bb.left\n };\n\n const wantedLeft = pos[this.options.position];\n if (left + wantedLeft > innerWidth) {\n left = pos['left'];\n } else if (wantedLeft < 0) {\n left = pos['right'];\n } else {\n left = wantedLeft;\n }\n\n Object.assign(app.style, {\n left: `${left}px`,\n top: `${top}px`\n });\n };\n })();\n\n _updateOutput() {\n\n // Check if component is present\n if (this._root.interaction.type()) {\n\n // Construct function name and call if present\n const method = `to${this._root.interaction.type().getAttribute('data-type')}`;\n this._root.interaction.result.value = typeof this._color[method] === 'function' ? this._color[method]().toString() : '';\n }\n\n // Fire listener if initialization is finish\n if (!this._initializingActive) {\n this._emit('change', this._color);\n }\n }\n\n _clearColor() {\n const {_root, options} = this;\n\n // Change only the button color if it isn't customized\n if (!options.useAsButton) {\n _root.button.style.color = 'rgba(0, 0, 0, 0.15)';\n }\n\n _root.button.classList.add('clear');\n\n if (!options.showAlways) {\n this.hide();\n }\n\n if (!this._initializingActive) {\n\n // Fire listener\n this._emit('save', null);\n }\n }\n\n _emit(event, ...args) {\n this._eventListener[event].forEach(cb => cb(...args, this));\n }\n\n on(event, cb) {\n\n // Validate\n if (typeof cb === 'function' && typeof event === 'string' && event in this._eventListener) {\n this._eventListener[event].push(cb);\n }\n\n return this;\n }\n\n off(event, cb) {\n const callBacks = this._eventListener[event];\n\n if (callBacks) {\n const index = callBacks.indexOf(cb);\n\n if (~index) {\n callBacks.splice(index, 1);\n }\n }\n\n return this;\n }\n\n /**\n * Appends a color to the swatch palette\n * @param color\n * @returns {boolean}\n */\n addSwatch(color) {\n const {values} = Color.parseToHSV(color);\n\n if (values) {\n const {_swatchColors, _root} = this;\n const hsvaColorObject = HSVaColor(...values);\n\n // Create new swatch HTMLElement\n const element = _.createElementFromString(\n ``\n );\n\n // Append element and save swatch data\n _root.swatches.appendChild(element);\n _swatchColors.push({element, hsvaColorObject});\n\n // Bind event\n this._eventBindings.push(\n _.on(element, 'click', () => {\n this.setHSVA(...hsvaColorObject.toHSVA(), true);\n this._emit('swatchselect', hsvaColorObject);\n })\n );\n\n return true;\n }\n\n return false;\n }\n\n /**\n * Removes a swatch color by it's index\n * @param index\n * @returns {boolean}\n */\n removeSwatch(index) {\n\n // Validate index\n if (typeof index === 'number') {\n const swatchColor = this._swatchColors[index];\n\n // Check swatch data\n if (swatchColor) {\n const {element} = swatchColor;\n\n // Remove HTML child and swatch data\n this._root.swatches.removeChild(element);\n this._swatchColors.splice(index, 1);\n return true;\n }\n }\n\n return false;\n }\n\n applyColor(silent = false) {\n const {preview, button} = this._root;\n\n // Change preview and current color\n const cssRGBaString = this._color.toRGBA().toString();\n preview.lastColor.style.color = cssRGBaString;\n\n // Change only the button color if it isn't customized\n if (!this.options.useAsButton) {\n button.style.color = cssRGBaString;\n }\n\n // User changed the color so remove the clear clas\n button.classList.remove('clear');\n\n // Save last color\n this._lastColor = this._color.clone();\n\n // Fire listener\n if (!this._initializingActive && !silent) {\n this._emit('save', this._color);\n }\n }\n\n /**\n * Destroy's all functionalitys\n */\n destroy() {\n this._eventBindings.forEach(args => _.off(...args));\n Object.keys(this.components).forEach(key => this.components[key].destroy());\n }\n\n /**\n * Destroy's all functionalitys and removes\n * the pickr element.\n */\n destroyAndRemove() {\n this.destroy();\n\n // Remove element\n const root = this._root.root;\n root.parentElement.removeChild(root);\n\n // remove .pcr-app\n const app = this._root.app;\n app.parentElement.removeChild(app);\n\n // There are references to various DOM elements stored in the pickr instance\n // This cleans all of them to avoid detached DOMs\n const pickr = this;\n Object.keys(pickr).forEach(key => pickr[key] = null);\n }\n\n /**\n * Hides the color-picker ui.\n */\n hide() {\n this._root.app.classList.remove('visible');\n return this;\n }\n\n /**\n * Shows the color-picker ui.\n */\n show() {\n if (this.options.disabled) return;\n this._root.app.classList.add('visible');\n this._rePositioningPicker();\n return this;\n }\n\n /**\n * @return {boolean} If the color picker is currently open\n */\n isOpen() {\n return this._root.app.classList.contains('visible');\n }\n\n /**\n * Set a specific color.\n * @param h Hue\n * @param s Saturation\n * @param v Value\n * @param a Alpha channel (0 - 1)\n * @param silent If the button should not change the color\n * @return boolean if the color has been accepted\n */\n setHSVA(h = 360, s = 0, v = 0, a = 1, silent = false) {\n\n // Deactivate color calculation\n const recalc = this._recalc; // Save state\n this._recalc = false;\n\n // Validate input\n if (h < 0 || h > 360 || s < 0 || s > 100 || v < 0 || v > 100 || a < 0 || a > 1) {\n return false;\n }\n\n // Short names\n const {hue, opacity, palette} = this.components;\n\n // Calculate y position of hue slider\n const hueWrapper = hue.options.wrapper;\n const hueY = hueWrapper.offsetHeight * (h / 360);\n hue.update(0, hueY);\n\n // Calculate y position of opacity slider\n const opacityWrapper = opacity.options.wrapper;\n const opacityY = opacityWrapper.offsetHeight * a;\n opacity.update(0, opacityY);\n\n // Calculate y and x position of color palette\n const pickerWrapper = palette.options.wrapper;\n const pickerX = pickerWrapper.offsetWidth * (s / 100);\n const pickerY = pickerWrapper.offsetHeight * (1 - (v / 100));\n palette.update(pickerX, pickerY);\n\n // Override current color and re-active color calculation\n this._color = HSVaColor(h, s, v, a);\n this._recalc = recalc; // Restore old state\n\n // Update output if recalculation is enabled\n if (this._recalc) {\n this._updateOutput();\n }\n\n // Check if call is silent\n if (!silent) {\n this.applyColor();\n }\n\n return true;\n }\n\n /**\n * Tries to parse a string which represents a color.\n * Examples: #fff\n * rgb 10 10 200\n * hsva 10 20 5 0.5\n * @param string\n * @param silent\n */\n setColor(string, silent = false) {\n\n // Check if null\n if (string === null) {\n this._clearColor();\n return true;\n }\n\n const {values, type} = Color.parseToHSV(string);\n\n // Check if color is ok\n if (values) {\n\n // Change selected color format\n const utype = type.toUpperCase();\n const {options} = this._root.interaction;\n const target = options.find(el => el.getAttribute('data-type').startsWith(utype));\n\n // Auto select only if not hidden\n if (target && !target.hidden) {\n for (const el of options) {\n el.classList[el === target ? 'add' : 'remove']('active');\n }\n }\n\n return this.setHSVA(...values, silent);\n }\n }\n\n /**\n * Changes the color _representation.\n * Allowed values are HEX, RGB, HSV, HSL and CMYK\n * @param type\n * @returns {boolean} if the selected type was valid.\n */\n setColorRepresentation(type) {\n\n // Force uppercase to allow a case-sensitiv comparison\n type = type.toUpperCase();\n\n // Find button with given type and trigger click event\n return !!this._root.interaction.options.find(v => v.getAttribute('data-type').startsWith(type) && !v.click());\n }\n\n /**\n * Returns the current color representaion. See setColorRepresentation\n * @returns {*}\n */\n getColorRepresentation() {\n return this._representation;\n }\n\n /**\n * @returns HSVaColor Current HSVaColor object.\n */\n getColor() {\n return this._color;\n }\n\n /**\n * @returns The root HTMLElement with all his components.\n */\n getRoot() {\n return this._root;\n }\n\n /**\n * Disable pickr\n */\n disable() {\n this.hide();\n this.options.disabled = true;\n this._root.button.classList.add('disabled');\n return this;\n }\n\n /**\n * Enable pickr\n */\n enable() {\n this.options.disabled = false;\n this._root.button.classList.remove('disabled');\n return this;\n }\n}\n\nfunction create(options) {\n const {components, strings, useAsButton, inline} = options;\n const hidden = con => con ? '' : 'style=\"display:none\" hidden';\n\n const root = _.createFromTemplate(`\n
\n \n ${useAsButton ? '' : ''}\n\n
\n
\n
\n \n
\n
\n\n
\n
\n
\n
\n\n
\n
\n
\n
\n\n
\n
\n
\n
\n
\n\n
\n\n
\n \n\n \n \n \n \n \n\n \n \n
\n
\n
\n `);\n\n const int = root.interaction;\n\n // Select option which is not hidden\n int.options.find(o => !o.hidden && !o.classList.add('active'));\n\n // Create method to find currenlty active option\n int.type = () => int.options.find(e => e.classList.contains('active'));\n return root;\n}\n\n// Static methods\nPickr.utils = {\n once: _.once,\n on: _.on,\n off: _.off,\n eventPath: _.eventPath,\n createElementFromString: _.createElementFromString,\n adjustableInputNumbers: _.adjustableInputNumbers,\n removeAttribute: _.removeAttribute,\n createFromTemplate: _.createFromTemplate\n};\n\n// Create instance via method\nPickr.create = (options) => new Pickr(options);\n\n// Export\nPickr.version = '0.4.11';\nexport default Pickr;\n"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap","webpack:///./src/js/lib/utils.js","webpack:///./src/js/lib/color.js","webpack:///./src/js/lib/hsvacolor.js","webpack:///./src/js/helper/moveable.js","webpack:///./src/js/helper/selectable.js","webpack:///./src/js/pickr.js"],"names":["root","factory","exports","module","define","amd","window","installedModules","__webpack_require__","moduleId","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","once","element","event","fn","options","on","helper","apply","this","arguments","removeEventListener","eventListener","off","method","elements","events","length","undefined","HTMLCollection","NodeList","Array","from","isArray","forEach","el","ev","_objectSpread","capture","slice","createElementFromString","html","div","document","createElement","innerHTML","trim","firstElementChild","removeAttribute","getAttribute","createFromTemplate","str","resolve","base","con","children","subtree","_i","_children","child","arr","push","eventPath","evt","path","composedPath","target","parentElement","adjustableInputNumbers","negative","isNumChar","handleScroll","e","val","selectionStart","numStart","num","isNaN","isFinite","mul","deltaY","inc","ctrlKey","newNum","Number","newStr","substr","substring","curPos","String","focus","setSelectionRange","preventDefault","dispatchEvent","Event","passive","padStart","string","maxLength","fillString","repeat","min","Math","max","floor","round","hsvToRgb","h","v","f","q","mod","hsvToHex","map","toString","hsvToCmyk","k","rgb","g","b","hsvToHsl","rgbToHsv","minVal","maxVal","delta","dr","dg","db","cmykToHsv","y","_toConsumableArray","hslToHsv","hexToHsv","hex","match","parseInt","parseToHSV","ctx","getContext","fillStyle","regex","cmyk","rgba","hsla","hsva","numarize","array","test","type","exec","_numarize2","_slicedToArray","values","concat","_numarize4","_numarize4$","a","splitAt","alpha","_splitAt$map2","_splitAt2","_numarize6","_numarize6$","_numarize8","_numarize8$","HSVaColor","ceil","that","toHSVA","rhsva","toFixed","toHSLA","Color","rhsla","toRGBA","rrgba","toCMYK","rcmyk","toHEXA","toUpperCase","join","clone","toHEX","Moveable","opt","assign","lockX","lockY","onchange","_tapstart","_","_tapstop","_tapmove","cache","wrapper","getBoundingClientRect","x","touch","touches","clientX","clientY","left","width","top","height","style","offsetWidth","trigger","update","wrapperRect","destroy","Selectable","className","onTap","classList","selectable_toConsumableArray","Pickr","_this","_classCallCheck","pickr_defineProperty","swatchselect","change","save","init","inline","_this$_root","_root","app","button","_window","innerWidth","innerHeight","bb","ab","bottom","pos","middle","right","wantedLeft","position","useAsButton","disabled","comparison","components","interaction","strings","swatches","default","defaultRepresentation","adjustableNumbers","showAlways","closeWithKey","_opt","preview","opacity","hue","palette","_preBuild","_buildComponents","_bindEvents","_finalBuild","color","addSwatch","requestAnimationFrame","cb","offsetParent","body","setColor","_rePositioningPicker","_representation","setColorRepresentation","show","_initializingActive","_emit","hidden","int","split","reduce","pv","cv","ci","querySelector","shadowRoot","keys","input","clear","find","add","contains","appendChild","removeChild","lastChild","insertBefore","nextSibling","parentNode","replaceChild","disable","transition","lastColor","hide","inst","comp","picker","_color","offsetHeight","cssRGBaString","background","currentColor","_recalc","_updateOutput","remove","slider","backgroundColor","selectable","updateTimeout","_this2","eventBindings","_clearColor","setHSVA","pickr_toConsumableArray","_lastColor","applyColor","result","stopImmediatePropagation","ck","isOpen","code","some","clearTimeout","setTimeout","_eventBindings","_this3","_len","args","_key","_eventListener","callBacks","index","indexOf","splice","_this4","_swatchColors","hsvaColorObject","swatchColor","silent","_this$_root2","_this5","pickr","recalc","_this$components","hueY","opacityY","pickerWrapper","pickerX","pickerY","_Color$parseToHSV2","utype","startsWith","_iteratorNormalCompletion","_didIteratorError","_iteratorError","_step","_iterator","iterator","next","done","err","return","click","utils","version"],"mappings":";CAAA,SAAAA,EAAAC,GACA,iBAAAC,SAAA,iBAAAC,OACAA,OAAAD,QAAAD,IACA,mBAAAG,eAAAC,IACAD,OAAA,GAAAH,GACA,iBAAAC,QACAA,QAAA,MAAAD,IAEAD,EAAA,MAAAC,IARA,CASCK,OAAA,WACD,mBCTA,IAAAC,EAAA,GAGA,SAAAC,EAAAC,GAGA,GAAAF,EAAAE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,QAAA6U,EAAAC,EAAiB3V,EAAjBrB,OAAAiX,cAAAL,GAAAG,EAAAC,EAAAE,QAAAC,MAAAP,GAAA,EAA0B,KAAfnU,EAAesU,EAAA7W,MACtBuC,EAAGmL,UAAUnL,IAAO+B,EAAS,MAAQ,UAAU,WAFzB,MAAA4S,GAAAP,GAAA,EAAAC,EAAAM,EAAA,YAAAR,GAAA,MAAAI,EAAAK,QAAAL,EAAAK,SAAA,WAAAR,EAAA,MAAAC,IAM9B,OAAOrV,KAAK2S,QAAL5S,MAAAC,KAAA4S,EAAgBvK,GAAhBC,OAAA,CAAwB+L,qDAUhBpM,GAMnB,OAHAA,EAAOA,EAAK+B,gBAGHhK,KAAK+M,MAAMkB,YAAYrO,QAAQ+Q,KAAK,SAAAlL,GAAC,OAAIA,EAAE3D,aAAa,aAAaoT,WAAWjN,KAAUxC,EAAEoQ,2DAQrG,OAAO7V,KAAK0P,mDAOZ,OAAO1P,KAAK4R,yCAOZ,OAAO5R,KAAK+M,wCAUZ,OAHA/M,KAAKwR,OACLxR,KAAKJ,QAAQkO,UAAW,EACxB9N,KAAK+M,MAAME,OAAOd,UAAUyE,IAAI,YACzB5Q,sCASP,OAFAA,KAAKJ,QAAQkO,UAAW,EACxB9N,KAAK+M,MAAME,OAAOd,UAAUgG,OAAO,YAC5BnS,0CAiEfqM,EAAMyJ,MAAQ,CACVtW,KAAMmL,EACN9K,GAAI8K,EACJvK,IAAKuK,EACLhI,UAAWgI,EACXtJ,wBAAyBsJ,EACzB1H,uBAAwB0H,EACxB9I,gBAAiB8I,EACjB5I,mBAAoB4I,GAIxB0B,EAAMvN,OAAS,SAACc,GAAD,OAAa,IAAIyM,EAAMzM,IAGtCyM,EAAM0J,QAAU,QACD1J","file":"pickr.es5.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"Pickr\"] = factory();\n\telse\n\t\troot[\"Pickr\"] = factory();\n})(window, function() {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 1);\n","/**\n * Add an eventlistener which will be fired only once.\n *\n * @param element Target element\n * @param event Event name\n * @param fn Callback\n * @param options Optional options\n * @return Array passed arguments\n */\nexport const once = (element, event, fn, options) => on(element, event, function helper() {\n fn.apply(this, arguments);\n this.removeEventListener(event, helper);\n}, options);\n\n/**\n * Add event(s) to element(s).\n * @param elements DOM-Elements\n * @param events Event names\n * @param fn Callback\n * @param options Optional options\n * @return Array passed arguments\n */\nexport const on = eventListener.bind(null, 'addEventListener');\n\n/**\n * Remove event(s) from element(s).\n * @param elements DOM-Elements\n * @param events Event names\n * @param fn Callback\n * @param options Optional options\n * @return Array passed arguments\n */\nexport const off = eventListener.bind(null, 'removeEventListener');\n\nfunction eventListener(method, elements, events, fn, options = {}) {\n\n // Normalize array\n if (elements instanceof HTMLCollection || elements instanceof NodeList) {\n elements = Array.from(elements);\n } else if (!Array.isArray(elements)) {\n elements = [elements];\n }\n\n if (!Array.isArray(events)) {\n events = [events];\n }\n\n elements.forEach(el =>\n events.forEach(ev =>\n el[method](ev, fn, {capture: false, ...options})\n )\n );\n\n return Array.prototype.slice.call(arguments, 1);\n}\n\n/**\n * Creates an DOM-Element out of a string (Single element).\n * @param html HTML representing a single element\n * @returns {Element | null} The element.\n */\nexport function createElementFromString(html) {\n const div = document.createElement('div');\n div.innerHTML = html.trim();\n return div.firstElementChild;\n}\n\n/**\n * Removes an attribute from a HTMLElement and returns the value.\n * @param el\n * @param name\n * @return {string}\n */\nexport function removeAttribute(el, name) {\n const value = el.getAttribute(name);\n el.removeAttribute(name);\n return value;\n}\n\n/**\n * Creates a new html element, every element which has\n * a 'data-key' attribute will be saved in a object (which will be returned)\n * where the value of 'data-key' ist the object-key and the value the HTMLElement.\n *\n * It's possible to create a hierarchy if you add a 'data-con' attribute. Every\n * sibling will be added to the object which will get the name from the 'data-con' attribute.\n *\n * If you want to create an Array out of multiple elements, you can use the 'data-arr' attribute,\n * the value defines the key and all elements, which has the same parent and the same 'data-arr' attribute,\n * would be added to it.\n *\n * @param str - The HTML String.\n */\nexport function createFromTemplate(str) {\n\n // Recursive function to resolve template\n function resolve(element, base = {}) {\n\n // Check key and container attribute\n const con = removeAttribute(element, 'data-con');\n const key = removeAttribute(element, 'data-key');\n\n // Check and save element\n if (key) {\n base[key] = element;\n }\n\n // Check all children\n const children = Array.from(element.children);\n const subtree = con ? (base[con] = {}) : base;\n for (let child of children) {\n\n // Check if element should be saved as array\n const arr = removeAttribute(child, 'data-arr');\n if (arr) {\n\n // Check if there is already an array and add element\n (subtree[arr] || (subtree[arr] = [])).push(child);\n } else {\n resolve(child, subtree);\n }\n }\n\n return base;\n }\n\n return resolve(createElementFromString(str));\n}\n\n/**\n * Polyfill for safari & firefox for the eventPath event property.\n * @param evt The event object.\n * @return [String] event path.\n */\nexport function eventPath(evt) {\n let path = evt.path || (evt.composedPath && evt.composedPath());\n if (path) return path;\n\n let el = evt.target.parentElement;\n path = [evt.target, el];\n while (el = el.parentElement) path.push(el);\n\n path.push(document, window);\n return path;\n}\n\n/**\n * Creates the ability to change numbers in an input field with the scroll-wheel.\n * @param el\n * @param negative\n */\nexport function adjustableInputNumbers(el, negative = true) {\n\n // Check if a char represents a number\n const isNumChar = c => (c >= '0' && c <= '9') || c === '-' || c === '.';\n\n function handleScroll(e) {\n const val = el.value;\n const off = el.selectionStart;\n let numStart = off;\n let num = ''; // Will be the number as string\n\n // Look back\n for (let i = off - 1; i > 0 && isNumChar(val[i]); i--) {\n num = val[i] + num;\n numStart--; // Find start of number\n }\n\n // Look forward\n for (let i = off, n = val.length; i < n && isNumChar(val[i]); i++) {\n num += val[i];\n }\n\n // Check if number is valid\n if (num.length > 0 && !isNaN(num) && isFinite(num)) {\n\n const mul = e.deltaY < 0 ? 1 : -1;\n const inc = e.ctrlKey ? mul * 5 : mul;\n let newNum = Number(num) + inc;\n\n if (!negative && newNum < 0) {\n newNum = 0;\n }\n\n const newStr = val.substr(0, numStart) + newNum + val.substring(numStart + num.length, val.length);\n const curPos = numStart + String(newNum).length;\n\n // Update value and set cursor\n el.value = newStr;\n el.focus();\n el.setSelectionRange(curPos, curPos);\n }\n\n // Prevent default\n e.preventDefault();\n\n // Trigger input event\n el.dispatchEvent(new Event('input'));\n }\n\n // Bind events\n on(el, 'focus', () => on(window, 'wheel', handleScroll, {passive: false}));\n on(el, 'blur', () => off(window, 'wheel', handleScroll));\n}\n\n/**\n * Cross browser padStart implementation\n * @param string\n * @param maxLength\n * @param fillString\n * @returns {string}\n */\nexport function padStart(string, maxLength, fillString = ' ') {\n maxLength = maxLength - string.length;\n\n if (maxLength <= 0 || !fillString.length) {\n return String(string);\n } else {\n\n if (maxLength > fillString.length) {\n fillString += fillString.repeat(maxLength / fillString.length);\n }\n\n return fillString.slice(0, maxLength) + String(string);\n }\n}\n","import {padStart} from '../lib/utils';\n\n// Shorthands\nconst {min, max, floor, round} = Math;\n\n/**\n * Tries to convert a color name to rgb/a hex representation\n * @param name\n * @returns {string | CanvasGradient | CanvasPattern}\n */\nfunction standardizeColor(name) {\n const ctx = document.createElement('canvas').getContext('2d');\n ctx.fillStyle = name;\n return ctx.fillStyle;\n}\n\n/**\n * Convert HSV spectrum to RGB.\n * @param h Hue\n * @param s Saturation\n * @param v Value\n * @returns {number[]} Array with rgb values.\n */\nexport function hsvToRgb(h, s, v) {\n h = (h / 360) * 6;\n s /= 100;\n v /= 100;\n\n let i = floor(h);\n\n let f = h - i;\n let p = v * (1 - s);\n let q = v * (1 - f * s);\n let t = v * (1 - (1 - f) * s);\n\n let mod = i % 6;\n let r = [v, q, p, p, t, v][mod];\n let g = [t, v, v, q, p, p][mod];\n let b = [p, p, t, v, v, q][mod];\n\n return [\n r * 255,\n g * 255,\n b * 255\n ];\n}\n\n/**\n * Convert HSV spectrum to Hex.\n * @param h Hue\n * @param s Saturation\n * @param v Value\n * @returns {string[]} Hex values\n */\nexport function hsvToHex(h, s, v) {\n return hsvToRgb(h, s, v).map(v =>\n padStart(round(v).toString(16), 2, '0')\n );\n}\n\n/**\n * Convert HSV spectrum to CMYK.\n * @param h Hue\n * @param s Saturation\n * @param v Value\n * @returns {number[]} CMYK values\n */\nexport function hsvToCmyk(h, s, v) {\n const rgb = hsvToRgb(h, s, v);\n const r = rgb[0] / 255;\n const g = rgb[1] / 255;\n const b = rgb[2] / 255;\n\n let k, c, m, y;\n\n k = min(1 - r, 1 - g, 1 - b);\n\n c = k === 1 ? 0 : (1 - r - k) / (1 - k);\n m = k === 1 ? 0 : (1 - g - k) / (1 - k);\n y = k === 1 ? 0 : (1 - b - k) / (1 - k);\n\n return [\n c * 100,\n m * 100,\n y * 100,\n k * 100\n ];\n}\n\n/**\n * Convert HSV spectrum to HSL.\n * @param h Hue\n * @param s Saturation\n * @param v Value\n * @returns {number[]} HSL values\n */\nexport function hsvToHsl(h, s, v) {\n s /= 100, v /= 100;\n\n let l = (2 - s) * v / 2;\n\n if (l !== 0) {\n if (l === 1) {\n s = 0;\n } else if (l < 0.5) {\n s = s * v / (l * 2);\n } else {\n s = s * v / (2 - l * 2);\n }\n }\n\n return [\n h,\n s * 100,\n l * 100\n ];\n}\n\n/**\n * Convert RGB to HSV.\n * @param r Red\n * @param g Green\n * @param b Blue\n * @return {number[]} HSV values.\n */\nfunction rgbToHsv(r, g, b) {\n r /= 255, g /= 255, b /= 255;\n\n let h, s, v;\n const minVal = min(r, g, b);\n const maxVal = max(r, g, b);\n const delta = maxVal - minVal;\n\n v = maxVal;\n if (delta === 0) {\n h = s = 0;\n } else {\n s = delta / maxVal;\n let dr = (((maxVal - r) / 6) + (delta / 2)) / delta;\n let dg = (((maxVal - g) / 6) + (delta / 2)) / delta;\n let db = (((maxVal - b) / 6) + (delta / 2)) / delta;\n\n if (r === maxVal) {\n h = db - dg;\n } else if (g === maxVal) {\n h = (1 / 3) + dr - db;\n } else if (b === maxVal) {\n h = (2 / 3) + dg - dr;\n }\n\n if (h < 0) {\n h += 1;\n } else if (h > 1) {\n h -= 1;\n }\n }\n\n return [\n h * 360,\n s * 100,\n v * 100\n ];\n}\n\n/**\n * Convert CMYK to HSV.\n * @param c Cyan\n * @param m Magenta\n * @param y Yellow\n * @param k Key (Black)\n * @return {number[]} HSV values.\n */\nfunction cmykToHsv(c, m, y, k) {\n c /= 100, m /= 100, y /= 100, k /= 100;\n\n const r = (1 - min(1, c * (1 - k) + k)) * 255;\n const g = (1 - min(1, m * (1 - k) + k)) * 255;\n const b = (1 - min(1, y * (1 - k) + k)) * 255;\n\n return [...rgbToHsv(r, g, b)];\n}\n\n/**\n * Convert HSL to HSV.\n * @param h Hue\n * @param s Saturation\n * @param l Lightness\n * @return {number[]} HSV values.\n */\nfunction hslToHsv(h, s, l) {\n s /= 100, l /= 100;\n s *= l < 0.5 ? l : 1 - l;\n\n let ns = (2 * s / (l + s)) * 100;\n let v = (l + s) * 100;\n return [h, ns, v];\n}\n\n/**\n * Convert HEX to HSV.\n * @param hex Hexadecimal string of rgb colors, can have length 3 or 6.\n * @return {number[]} HSV values.\n */\nfunction hexToHsv(hex) {\n return rgbToHsv(...hex.match(/.{2}/g).map(v => parseInt(v, 16)));\n}\n\n/**\n * Try's to parse a string which represents a color to a HSV array.\n * Current supported types are cmyk, rgba, hsla and hexadecimal.\n * @param str\n * @return {*}\n */\nexport function parseToHSV(str) {\n\n // Check if string is a color-name\n str = str.match(/^[a-zA-Z]+$/) ? standardizeColor(str) : str;\n\n // Regular expressions to match different types of color represention\n const regex = {\n cmyk: /^cmyk[\\D]+(\\d+)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]+(\\d+)/i,\n rgba: /^(rgb|rgba)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]*?([\\d.]+|$)/i,\n hsla: /^(hsl|hsla)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]*?([\\d.]+|$)/i,\n hsva: /^(hsv|hsva)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]*?([\\d.]+|$)/i,\n hex: /^#?(([\\dA-Fa-f]{3,4})|([\\dA-Fa-f]{6})|([\\dA-Fa-f]{8}))$/i\n };\n\n /**\n * Takes an Array of any type, convert strings which represents\n * a number to a number an anything else to undefined.\n * @param array\n * @return {*}\n */\n const numarize = array => array.map(v => /^(|\\d+)\\.\\d+|\\d+$/.test(v) ? Number(v) : undefined);\n\n let match;\n for (const type in regex) {\n\n // Check if current scheme passed\n if (!(match = regex[type].exec(str)))\n continue;\n\n // Try to convert\n switch (type) {\n case 'cmyk': {\n let [, c, m, y, k] = numarize(match);\n\n if (c > 100 || m > 100 || y > 100 || k > 100)\n break;\n\n return {values: [...cmykToHsv(c, m, y, k), 1], type};\n }\n case 'rgba': {\n let [, , r, g, b, a = 1] = numarize(match);\n\n if (r > 255 || g > 255 || b > 255 || a < 0 || a > 1)\n break;\n\n return {values: [...rgbToHsv(r, g, b), a], type};\n }\n case 'hex': {\n const splitAt = (s, i) => [s.substring(0, i), s.substring(i, s.length)];\n let [, hex] = match;\n\n // Fill up opacity if not declared\n if (hex.length === 3) {\n hex += 'F';\n } else if (hex.length === 6) {\n hex += 'FF';\n }\n\n let alpha;\n if (hex.length === 4) {\n [hex, alpha] = splitAt(hex, 3).map(v => v + v);\n } else if (hex.length === 8) {\n [hex, alpha] = splitAt(hex, 6);\n }\n\n // Convert 0 - 255 to 0 - 1 for opacity\n alpha = parseInt(alpha, 16) / 255;\n return {values: [...hexToHsv(hex), alpha], type};\n }\n case 'hsla': {\n let [, , h, s, l, a = 1] = numarize(match);\n\n if (h > 360 || s > 100 || l > 100 || a < 0 || a > 1)\n break;\n\n return {values: [...hslToHsv(h, s, l), a], type};\n }\n case 'hsva': {\n let [, , h, s, v, a = 1] = numarize(match);\n\n if (h > 360 || s > 100 || v > 100 || a < 0 || a > 1)\n break;\n\n return {values: [h, s, v, a], type};\n }\n }\n }\n\n return {values: null, type: null};\n}\n","import {padStart} from '../lib/utils';\nimport * as Color from './color';\n\n/**\n * Simple class which holds the properties\n * of the color represention model hsla (hue saturation lightness alpha)\n */\nexport function HSVaColor(h = 0, s = 0, v = 0, a = 1) {\n\n const ceil = Math.ceil;\n const that = {\n h, s, v, a,\n\n toHSVA() {\n const hsva = [that.h, that.s, that.v];\n const rhsva = hsva.map(ceil);\n\n hsva.push(that.a);\n hsva.toString = () => `hsva(${rhsva[0]}, ${rhsva[1]}%, ${rhsva[2]}%, ${that.a.toFixed(1)})`;\n return hsva;\n },\n\n toHSLA() {\n const hsla = Color.hsvToHsl(that.h, that.s, that.v);\n const rhsla = hsla.map(ceil);\n\n hsla.push(that.a);\n hsla.toString = () => `hsla(${rhsla[0]}, ${rhsla[1]}%, ${rhsla[2]}%, ${that.a.toFixed(1)})`;\n return hsla;\n },\n\n toRGBA() {\n const rgba = Color.hsvToRgb(that.h, that.s, that.v);\n const rrgba = rgba.map(ceil);\n\n rgba.push(that.a);\n rgba.toString = () => `rgba(${rrgba[0]}, ${rrgba[1]}, ${rrgba[2]}, ${that.a.toFixed(1)})`;\n return rgba;\n },\n\n toCMYK() {\n const cmyk = Color.hsvToCmyk(that.h, that.s, that.v);\n const rcmyk = cmyk.map(ceil);\n\n cmyk.toString = () => `cmyk(${rcmyk[0]}%, ${rcmyk[1]}%, ${rcmyk[2]}%, ${rcmyk[3]}%)`;\n return cmyk;\n },\n\n toHEXA() {\n const hex = Color.hsvToHex(...[that.h, that.s, that.v]);\n\n hex.toString = () => {\n\n // Check if alpha channel make sense, convert it to 255 number space, convert\n // to hex and pad it with zeros if needet.\n const alpha = that.a >= 1 ? '' : padStart(Number((that.a * 255).toFixed(0))\n .toString(16)\n .toUpperCase(), 2, '0');\n\n return `#${hex.join('').toUpperCase() + alpha}`;\n };\n\n return hex;\n },\n\n clone() {\n return HSVaColor(that.h, that.s, that.v, that.a);\n }\n };\n\n // TODO: Remove in 0.5.0\n that.toHEX = that.toHEXA;\n return that;\n}\n","import * as _ from './../lib/utils';\r\n\r\nexport default function Moveable(opt) {\r\n\r\n const that = {\r\n\r\n // Assign default values\r\n options: Object.assign({\r\n lockX: false,\r\n lockY: false,\r\n onchange: () => 0\r\n }, opt),\r\n\r\n _tapstart(evt) {\r\n _.on(document, ['mouseup', 'touchend', 'touchcancel'], that._tapstop);\r\n _.on(document, ['mousemove', 'touchmove'], that._tapmove);\r\n\r\n // Prevent default touch event\r\n evt.preventDefault();\r\n\r\n // Trigger\r\n that._tapmove(evt);\r\n },\r\n\r\n _tapmove(evt) {\r\n const {options, cache} = that;\r\n const {element} = options;\r\n const b = that.options.wrapper.getBoundingClientRect();\r\n\r\n let x = 0, y = 0;\r\n if (evt) {\r\n const touch = evt && evt.touches && evt.touches[0];\r\n x = evt ? (touch || evt).clientX : 0;\r\n y = evt ? (touch || evt).clientY : 0;\r\n\r\n // Reset to bounds\r\n if (x < b.left) x = b.left;\r\n else if (x > b.left + b.width) x = b.left + b.width;\r\n if (y < b.top) y = b.top;\r\n else if (y > b.top + b.height) y = b.top + b.height;\r\n\r\n // Normalize\r\n x -= b.left;\r\n y -= b.top;\r\n } else if (cache) {\r\n x = cache.x * b.width;\r\n y = cache.y * b.height;\r\n }\r\n\r\n if (!options.lockX) {\r\n element.style.left = `calc(${x / b.width * 100}% - ${element.offsetWidth / 2}px)`;\r\n }\r\n\r\n if (!options.lockY) {\r\n element.style.top = `calc(${y / b.height * 100}% - ${element.offsetWidth / 2}px)`;\r\n }\r\n\r\n that.cache = {x: x / b.width, y: y / b.height};\r\n options.onchange(x, y);\r\n },\r\n\r\n _tapstop() {\r\n _.off(document, ['mouseup', 'touchend', 'touchcancel'], that._tapstop);\r\n _.off(document, ['mousemove', 'touchmove'], that._tapmove);\r\n },\r\n\r\n trigger() {\r\n that._tapmove();\r\n },\r\n\r\n update(x = 0, y = 0) {\r\n const wrapperRect = that.options.wrapper.getBoundingClientRect();\r\n that._tapmove({\r\n clientX: wrapperRect.left + x,\r\n clientY: wrapperRect.top + y\r\n });\r\n },\r\n\r\n destroy() {\r\n const {options, _tapstart} = that;\r\n _.off([options.wrapper, options.element], 'mousedown', _tapstart);\r\n _.off([options.wrapper, options.element], 'touchstart', _tapstart, {\r\n passive: false\r\n });\r\n }\r\n };\r\n\r\n // Initilize\r\n const {options, _tapstart} = that;\r\n _.on([options.wrapper, options.element], 'mousedown', _tapstart);\r\n _.on([options.wrapper, options.element], 'touchstart', _tapstart, {\r\n passive: false\r\n });\r\n\r\n return that;\r\n}\r\n","import * as _ from './../lib/utils';\r\n\r\nexport default function Selectable(opt = {}) {\r\n opt = Object.assign({\r\n onchange: () => 0,\r\n className: '',\r\n elements: []\r\n }, opt);\r\n\r\n const onTap = _.on(opt.elements, 'click', evt => {\r\n opt.elements.forEach(e =>\r\n e.classList[evt.target === e ? 'add' : 'remove'](opt.className)\r\n );\r\n\r\n opt.onchange(evt);\r\n });\r\n\r\n return {\r\n destroy: () => _.off(...onTap)\r\n };\r\n}\r\n","// Import styles\nimport '../scss/pickr.scss';\n\n// Import utils\nimport * as _ from './lib/utils';\nimport * as Color from './lib/color';\n\n// Import classes\nimport {HSVaColor} from './lib/hsvacolor';\nimport Moveable from './helper/moveable';\nimport Selectable from './helper/selectable';\n\nclass Pickr {\n\n // Will be used to prevent specific actions during initilization\n _initializingActive = true;\n\n // Replace element with color picker\n _recalc = true;\n\n // Current and last color for comparison\n _color = HSVaColor();\n _lastColor = HSVaColor();\n _swatchColors = [];\n\n // Evenlistener name: [callbacks]\n _eventListener = {\n 'swatchselect': [],\n 'change': [],\n 'save': [],\n 'init': []\n };\n\n constructor(opt) {\n\n // Assign default values\n this.options = opt = Object.assign({\n useAsButton: false,\n disabled: false,\n comparison: true,\n\n components: {\n interaction: {}\n },\n strings: {},\n\n swatches: null,\n inline: false,\n\n default: 'fff',\n defaultRepresentation: null,\n position: 'middle',\n adjustableNumbers: true,\n showAlways: false,\n\n closeWithKey: 'Escape'\n }, opt);\n const {swatches, inline, components} = opt;\n\n // Check interaction section\n if (!components.interaction) {\n components.interaction = {};\n }\n\n // Overwrite palette if preview, opacity or hue are true\n const {preview, opacity, hue, palette} = components;\n components.palette = palette || preview || opacity || hue;\n\n // Per default enabled if inline\n if (inline) {\n opt.showAlways = true;\n }\n\n // Initialize picker\n this._preBuild();\n this._buildComponents();\n this._bindEvents();\n\n // Finalize build\n this._finalBuild();\n\n // Append pre-defined swatch colors\n if (swatches && swatches.length) {\n swatches.forEach(color => this.addSwatch(color));\n }\n\n // Initilization is finish, pickr is visible and ready for usage\n const {button} = this._root;\n requestAnimationFrame((function cb() {\n\n // offsetParent of body is always 0. So check if it is the body\n if (button.offsetParent === null && button !== document.body) {\n return requestAnimationFrame(cb.bind(this));\n }\n\n // Apply default color\n this.setColor(opt.default);\n this._rePositioningPicker();\n\n // Initialize color representation\n if (opt.defaultRepresentation) {\n this._representation = opt.defaultRepresentation;\n this.setColorRepresentation(this._representation);\n }\n\n // Show pickr if locked\n if (opt.showAlways) {\n this.show();\n }\n\n // Initialization is done - pickr is usable, fire init event\n this._initializingActive = false;\n this._emit('init');\n }).bind(this));\n }\n\n // Does only the absolutly basic thing to initialize the components\n _preBuild() {\n const opt = this.options;\n\n // Check if element is selector\n if (typeof opt.el === 'string') {\n\n // Resolve possible shadow dom access\n opt.el = opt.el.split(/>>/g).reduce((pv, cv, ci, a) => {\n pv = pv.querySelector(cv);\n return ci < a.length - 1 ? pv.shadowRoot : pv;\n }, document);\n }\n\n // Create element and append it to body to\n // prevent initialization errors\n this._root = create(opt);\n\n // Check if a custom button is used\n if (opt.useAsButton) {\n this._root.button = opt.el; // Replace button with customized button\n }\n\n document.body.appendChild(this._root.root);\n }\n\n _finalBuild() {\n const opt = this.options;\n const root = this._root;\n\n // Remove from body\n document.body.removeChild(root.root);\n\n if (opt.inline) {\n const {parentElement} = opt.el;\n\n if (parentElement.lastChild === opt.el) {\n parentElement.appendChild(root.app);\n } else {\n parentElement.insertBefore(root.app, opt.el.nextSibling);\n }\n } else {\n document.body.appendChild(root.app);\n }\n\n // Don't replace the the element if a custom button is used\n if (!opt.useAsButton) {\n\n // Replace element with actual color-picker\n opt.el.parentNode.replaceChild(root.root, opt.el);\n }\n\n // Call disable to also add the disabled class\n if (opt.disabled) {\n this.disable();\n }\n\n // Check if color comparison is disabled, if yes - remove transitions so everything keeps smoothly\n if (!opt.comparison) {\n root.button.style.transition = 'none';\n if (!opt.useAsButton) {\n root.preview.lastColor.style.transition = 'none';\n }\n }\n\n this.hide();\n }\n\n _buildComponents() {\n\n // Instance reference\n const inst = this;\n const comp = this.options.components;\n\n const components = {\n\n palette: Moveable({\n element: inst._root.palette.picker,\n wrapper: inst._root.palette.palette,\n\n onchange(x, y) {\n if (!comp.palette) return;\n const {_color, _root, options} = inst;\n\n // Calculate saturation based on the position\n _color.s = (x / this.wrapper.offsetWidth) * 100;\n\n // Calculate the value\n _color.v = 100 - (y / this.wrapper.offsetHeight) * 100;\n\n // Prevent falling under zero\n _color.v < 0 ? _color.v = 0 : 0;\n\n // Set picker and gradient color\n const cssRGBaString = _color.toRGBA().toString();\n this.element.style.background = cssRGBaString;\n this.wrapper.style.background = `\n linear-gradient(to top, rgba(0, 0, 0, ${_color.a}), transparent), \n linear-gradient(to left, hsla(${_color.h}, 100%, 50%, ${_color.a}), rgba(255, 255, 255, ${_color.a}))\n `;\n\n // Check if color is locked\n if (!options.comparison) {\n _root.button.style.color = cssRGBaString;\n\n if (!options.useAsButton) {\n _root.preview.lastColor.style.color = cssRGBaString;\n }\n }\n\n // Change current color\n _root.preview.currentColor.style.color = cssRGBaString;\n\n // Update the input field only if the user is currently not typing\n if (inst._recalc) {\n inst._updateOutput();\n }\n\n // If the user changes the color, remove the cleared icon\n _root.button.classList.remove('clear');\n }\n }),\n\n hue: Moveable({\n lockX: true,\n element: inst._root.hue.picker,\n wrapper: inst._root.hue.slider,\n\n onchange(x, y) {\n if (!comp.hue || !comp.palette) return;\n\n // Calculate hue\n inst._color.h = (y / this.wrapper.offsetHeight) * 360;\n\n // Update color\n this.element.style.backgroundColor = `hsl(${inst._color.h}, 100%, 50%)`;\n components.palette.trigger();\n }\n }),\n\n opacity: Moveable({\n lockX: true,\n element: inst._root.opacity.picker,\n wrapper: inst._root.opacity.slider,\n\n onchange(x, y) {\n if (!comp.opacity || !comp.palette) return;\n\n // Calculate opacity\n inst._color.a = Math.round(((y / this.wrapper.offsetHeight)) * 1e2) / 100;\n\n // Update color\n this.element.style.background = `rgba(0, 0, 0, ${inst._color.a})`;\n inst.components.palette.trigger();\n }\n }),\n\n selectable: Selectable({\n elements: inst._root.interaction.options,\n className: 'active',\n onchange(e) {\n inst._representation = e.target.getAttribute('data-type').toUpperCase();\n inst._updateOutput();\n }\n })\n };\n\n this.components = components;\n }\n\n _bindEvents() {\n const {_root, options} = this;\n\n const eventBindings = [\n\n // Clear color\n _.on(_root.interaction.clear, 'click', () => this._clearColor()),\n\n // Select last color on click\n _.on(_root.preview.lastColor, 'click', () => this.setHSVA(...this._lastColor.toHSVA())),\n\n // Save color\n _.on(_root.interaction.save, 'click', () => {\n !this.applyColor() && !options.showAlways && this.hide();\n }),\n\n // Detect user input and disable auto-recalculation\n _.on(_root.interaction.result, ['keyup', 'input'], e => {\n this._recalc = false;\n\n // Fire listener if initialization is finish and changed color was valid\n if (this.setColor(e.target.value, true) && !this._initializingActive) {\n this._emit('change', this._color);\n }\n\n e.stopImmediatePropagation();\n }),\n\n // Cancel input detection on color change\n _.on([\n _root.palette.palette,\n _root.palette.picker,\n _root.hue.slider,\n _root.hue.picker,\n _root.opacity.slider,\n _root.opacity.picker\n ], ['mousedown', 'touchstart'], () => this._recalc = true)\n ];\n\n // Provide hiding / showing abilities only if showAlways is false\n if (!options.showAlways) {\n const ck = options.closeWithKey;\n\n eventBindings.push(\n // Save and hide / show picker\n _.on(_root.button, 'click', () => this.isOpen() ? this.hide() : this.show()),\n\n // Close with escape key\n _.on(document, 'keyup', e => this.isOpen() && (e.key === ck || e.code === ck) && this.hide()),\n\n // Cancel selecting if the user taps behind the color picker\n _.on(document, ['touchstart', 'mousedown'], e => {\n if (this.isOpen() && !_.eventPath(e).some(el => el === _root.app || el === _root.button)) {\n this.hide();\n }\n }, {capture: true})\n );\n }\n\n // Make input adjustable if enabled\n if (options.adjustableNumbers) {\n _.adjustableInputNumbers(_root.interaction.result, false);\n }\n\n if (!options.inline) {\n let updateTimeout;\n\n // Re-calc position on window resize, scroll and wheel\n eventBindings.push(_.on(window, ['scroll', 'wheel', 'resize'], () => {\n if (this.isOpen()) {\n this.hide();\n\n if (updateTimeout) {\n clearTimeout(updateTimeout);\n }\n\n updateTimeout = setTimeout(() => this.show(), 250);\n }\n }));\n }\n\n // Save bindings\n this._eventBindings = eventBindings;\n }\n\n _rePositioningPicker = (() => {\n const padding = 8;\n let left, top;\n\n return () => {\n\n // No repositioning needed if inline\n if (this.options.inline) {\n return;\n }\n\n const {app, button} = this._root;\n const {innerWidth, innerHeight} = window;\n const bb = button.getBoundingClientRect();\n const ab = app.getBoundingClientRect();\n\n // Check if picker is cuttet of from the top & bottom\n if (innerHeight - (bb.bottom + ab.height + padding) < 0) {\n top = bb.top - ab.height - padding;\n } else {\n top = bb.bottom + padding;\n }\n\n // Positioning picker on the x-axis\n const pos = {\n left: bb.left + bb.width - ab.width,\n middle: (-ab.width / 2) + (bb.left + bb.width / 2),\n right: bb.left\n };\n\n const wantedLeft = pos[this.options.position];\n if (left + wantedLeft > innerWidth) {\n left = pos['left'];\n } else if (wantedLeft < 0) {\n left = pos['right'];\n } else {\n left = wantedLeft;\n }\n\n Object.assign(app.style, {\n left: `${left}px`,\n top: `${top}px`\n });\n };\n })();\n\n _updateOutput() {\n\n // Check if component is present\n if (this._root.interaction.type()) {\n\n // Construct function name and call if present\n const method = `to${this._root.interaction.type().getAttribute('data-type')}`;\n this._root.interaction.result.value = typeof this._color[method] === 'function' ? this._color[method]().toString() : '';\n }\n\n // Fire listener if initialization is finish\n if (!this._initializingActive) {\n this._emit('change', this._color);\n }\n }\n\n _clearColor() {\n const {_root, options} = this;\n\n // Change only the button color if it isn't customized\n if (!options.useAsButton) {\n _root.button.style.color = 'rgba(0, 0, 0, 0.15)';\n }\n\n _root.button.classList.add('clear');\n\n if (!options.showAlways) {\n this.hide();\n }\n\n if (!this._initializingActive) {\n\n // Fire listener\n this._emit('save', null);\n }\n }\n\n _emit(event, ...args) {\n this._eventListener[event].forEach(cb => cb(...args, this));\n }\n\n on(event, cb) {\n\n // Validate\n if (typeof cb === 'function' && typeof event === 'string' && event in this._eventListener) {\n this._eventListener[event].push(cb);\n }\n\n return this;\n }\n\n off(event, cb) {\n const callBacks = this._eventListener[event];\n\n if (callBacks) {\n const index = callBacks.indexOf(cb);\n\n if (~index) {\n callBacks.splice(index, 1);\n }\n }\n\n return this;\n }\n\n /**\n * Appends a color to the swatch palette\n * @param color\n * @returns {boolean}\n */\n addSwatch(color) {\n const {values} = Color.parseToHSV(color);\n\n if (values) {\n const {_swatchColors, _root} = this;\n const hsvaColorObject = HSVaColor(...values);\n\n // Create new swatch HTMLElement\n const element = _.createElementFromString(\n ``\n );\n\n // Append element and save swatch data\n _root.swatches.appendChild(element);\n _swatchColors.push({element, hsvaColorObject});\n\n // Bind event\n this._eventBindings.push(\n _.on(element, 'click', () => {\n this.setHSVA(...hsvaColorObject.toHSVA(), true);\n this._emit('swatchselect', hsvaColorObject);\n })\n );\n\n return true;\n }\n\n return false;\n }\n\n /**\n * Removes a swatch color by it's index\n * @param index\n * @returns {boolean}\n */\n removeSwatch(index) {\n\n // Validate index\n if (typeof index === 'number') {\n const swatchColor = this._swatchColors[index];\n\n // Check swatch data\n if (swatchColor) {\n const {element} = swatchColor;\n\n // Remove HTML child and swatch data\n this._root.swatches.removeChild(element);\n this._swatchColors.splice(index, 1);\n return true;\n }\n }\n\n return false;\n }\n\n applyColor(silent = false) {\n const {preview, button} = this._root;\n\n // Change preview and current color\n const cssRGBaString = this._color.toRGBA().toString();\n preview.lastColor.style.color = cssRGBaString;\n\n // Change only the button color if it isn't customized\n if (!this.options.useAsButton) {\n button.style.color = cssRGBaString;\n }\n\n // User changed the color so remove the clear clas\n button.classList.remove('clear');\n\n // Save last color\n this._lastColor = this._color.clone();\n\n // Fire listener\n if (!this._initializingActive && !silent) {\n this._emit('save', this._color);\n }\n }\n\n /**\n * Destroy's all functionalitys\n */\n destroy() {\n this._eventBindings.forEach(args => _.off(...args));\n Object.keys(this.components).forEach(key => this.components[key].destroy());\n }\n\n /**\n * Destroy's all functionalitys and removes\n * the pickr element.\n */\n destroyAndRemove() {\n this.destroy();\n\n // Remove element\n const root = this._root.root;\n root.parentElement.removeChild(root);\n\n // remove .pcr-app\n const app = this._root.app;\n app.parentElement.removeChild(app);\n\n // There are references to various DOM elements stored in the pickr instance\n // This cleans all of them to avoid detached DOMs\n const pickr = this;\n Object.keys(pickr).forEach(key => pickr[key] = null);\n }\n\n /**\n * Hides the color-picker ui.\n */\n hide() {\n this._root.app.classList.remove('visible');\n return this;\n }\n\n /**\n * Shows the color-picker ui.\n */\n show() {\n if (this.options.disabled) return;\n this._root.app.classList.add('visible');\n this._rePositioningPicker();\n return this;\n }\n\n /**\n * @return {boolean} If the color picker is currently open\n */\n isOpen() {\n return this._root.app.classList.contains('visible');\n }\n\n /**\n * Set a specific color.\n * @param h Hue\n * @param s Saturation\n * @param v Value\n * @param a Alpha channel (0 - 1)\n * @param silent If the button should not change the color\n * @return boolean if the color has been accepted\n */\n setHSVA(h = 360, s = 0, v = 0, a = 1, silent = false) {\n\n // Deactivate color calculation\n const recalc = this._recalc; // Save state\n this._recalc = false;\n\n // Validate input\n if (h < 0 || h > 360 || s < 0 || s > 100 || v < 0 || v > 100 || a < 0 || a > 1) {\n return false;\n }\n\n // Short names\n const {hue, opacity, palette} = this.components;\n\n // Calculate y position of hue slider\n const hueWrapper = hue.options.wrapper;\n const hueY = hueWrapper.offsetHeight * (h / 360);\n hue.update(0, hueY);\n\n // Calculate y position of opacity slider\n const opacityWrapper = opacity.options.wrapper;\n const opacityY = opacityWrapper.offsetHeight * a;\n opacity.update(0, opacityY);\n\n // Calculate y and x position of color palette\n const pickerWrapper = palette.options.wrapper;\n const pickerX = pickerWrapper.offsetWidth * (s / 100);\n const pickerY = pickerWrapper.offsetHeight * (1 - (v / 100));\n palette.update(pickerX, pickerY);\n\n // Override current color and re-active color calculation\n this._color = HSVaColor(h, s, v, a);\n this._recalc = recalc; // Restore old state\n\n // Update output if recalculation is enabled\n if (this._recalc) {\n this._updateOutput();\n }\n\n // Check if call is silent\n if (!silent) {\n this.applyColor();\n }\n\n return true;\n }\n\n /**\n * Tries to parse a string which represents a color.\n * Examples: #fff\n * rgb 10 10 200\n * hsva 10 20 5 0.5\n * @param string\n * @param silent\n */\n setColor(string, silent = false) {\n\n // Check if null\n if (string === null) {\n this._clearColor();\n return true;\n }\n\n const {values, type} = Color.parseToHSV(string);\n\n // Check if color is ok\n if (values) {\n\n // Change selected color format\n const utype = type.toUpperCase();\n const {options} = this._root.interaction;\n const target = options.find(el => el.getAttribute('data-type').startsWith(utype));\n\n // Auto select only if not hidden\n if (target && !target.hidden) {\n for (const el of options) {\n el.classList[el === target ? 'add' : 'remove']('active');\n }\n }\n\n return this.setHSVA(...values, silent);\n }\n }\n\n /**\n * Changes the color _representation.\n * Allowed values are HEX, RGB, HSV, HSL and CMYK\n * @param type\n * @returns {boolean} if the selected type was valid.\n */\n setColorRepresentation(type) {\n\n // Force uppercase to allow a case-sensitiv comparison\n type = type.toUpperCase();\n\n // Find button with given type and trigger click event\n return !!this._root.interaction.options.find(v => v.getAttribute('data-type').startsWith(type) && !v.click());\n }\n\n /**\n * Returns the current color representaion. See setColorRepresentation\n * @returns {*}\n */\n getColorRepresentation() {\n return this._representation;\n }\n\n /**\n * @returns HSVaColor Current HSVaColor object.\n */\n getColor() {\n return this._color;\n }\n\n /**\n * @returns The root HTMLElement with all his components.\n */\n getRoot() {\n return this._root;\n }\n\n /**\n * Disable pickr\n */\n disable() {\n this.hide();\n this.options.disabled = true;\n this._root.button.classList.add('disabled');\n return this;\n }\n\n /**\n * Enable pickr\n */\n enable() {\n this.options.disabled = false;\n this._root.button.classList.remove('disabled');\n return this;\n }\n}\n\nfunction create(options) {\n const {components, strings, useAsButton, inline} = options;\n const hidden = con => con ? '' : 'style=\"display:none\" hidden';\n\n const root = _.createFromTemplate(`\n
\n \n ${useAsButton ? '' : ''}\n\n
\n
\n
\n \n
\n
\n\n
\n
\n
\n
\n\n
\n
\n
\n
\n\n
\n
\n
\n
\n
\n\n
\n\n
\n \n\n \n \n \n \n \n\n \n \n
\n
\n
\n `);\n\n const int = root.interaction;\n\n // Select option which is not hidden\n int.options.find(o => !o.hidden && !o.classList.add('active'));\n\n // Create method to find currenlty active option\n int.type = () => int.options.find(e => e.classList.contains('active'));\n return root;\n}\n\n// Static methods\nPickr.utils = {\n once: _.once,\n on: _.on,\n off: _.off,\n eventPath: _.eventPath,\n createElementFromString: _.createElementFromString,\n adjustableInputNumbers: _.adjustableInputNumbers,\n removeAttribute: _.removeAttribute,\n createFromTemplate: _.createFromTemplate\n};\n\n// Create instance via method\nPickr.create = (options) => new Pickr(options);\n\n// Export\nPickr.version = '0.5.0';\nexport default Pickr;\n"],"sourceRoot":""} \ No newline at end of file diff --git a/dist/pickr.min.css b/dist/pickr.min.css index bff1bf48..87e9d323 100644 --- a/dist/pickr.min.css +++ b/dist/pickr.min.css @@ -1,3 +1,3 @@ -/*! Pickr 0.4.11 MIT | https://github.com/Simonwep/pickr */ +/*! Pickr 0.5.0 MIT | https://github.com/Simonwep/pickr */ .pickr{position:relative;overflow:visible;transform:translateY(0)}.pickr *{box-sizing:border-box}.pickr .pcr-button{position:relative;height:2em;width:2em;padding:.5em;cursor:pointer;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,sans-serif;border-radius:.15em;background:url('data:image/svg+xml;utf8, ') no-repeat 50%;background-size:0;transition:all .3s}.pickr .pcr-button:before{background:url('data:image/svg+xml;utf8, ');background-size:.5em;z-index:-1;z-index:auto}.pickr .pcr-button:after,.pickr .pcr-button:before{position:absolute;content:"";top:0;left:0;width:100%;height:100%;border-radius:.15em}.pickr .pcr-button:after{transition:background .3s;background:currentColor}.pickr .pcr-button.clear{background-size:70%}.pickr .pcr-button.clear:before{opacity:0}.pickr .pcr-button.clear:focus{box-shadow:0 0 0 1px #f1f3f4,0 0 0 3px currentColor}.pickr .pcr-button.disabled{cursor:not-allowed}.pcr-app button,.pcr-app input,.pickr button,.pickr input{outline:none;border:none;-webkit-appearance:none}.pcr-app button:focus,.pcr-app input:focus,.pickr button:focus,.pickr input:focus{box-shadow:0 0 0 1px #f1f3f4,0 0 0 3px currentColor}.pcr-app{position:fixed;display:flex;flex-direction:column;z-index:10000;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,sans-serif;box-shadow:0 .15em 1.5em 0 rgba(0,0,0,.1),0 0 1em 0 rgba(0,0,0,.03);width:28.5em;max-width:95vw;padding:.8em;border-radius:.1em;background:#fff;opacity:0;visibility:hidden;transition:opacity .3s;left:0;top:0}.pcr-app.visible{visibility:visible;opacity:1}.pcr-app .pcr-swatches{display:flex;flex-wrap:wrap;margin-top:.75em}.pcr-app .pcr-swatches.pcr-last{margin:0}@supports (display:grid){.pcr-app .pcr-swatches{display:grid;align-items:center;justify-content:space-around;grid-template-columns:repeat(auto-fit,1.75em)}}.pcr-app .pcr-swatches>button{position:relative;width:1.75em;height:1.75em;border-radius:.15em;cursor:pointer;margin:2.5px;flex-shrink:0;justify-self:center;transition:all .15s;overflow:hidden;background:transparent;z-index:1}.pcr-app .pcr-swatches>button:before{position:absolute;content:"";top:0;left:0;width:100%;height:100%;background:url('data:image/svg+xml;utf8, ');background-size:6px;border-radius:.15em;z-index:-1}.pcr-app .pcr-swatches>button:after{content:"";position:absolute;top:0;left:0;width:100%;height:100%;background:currentColor;border:1px solid rgba(0,0,0,.05);border-radius:.15em;box-sizing:border-box}.pcr-app .pcr-swatches>button:hover{filter:brightness(1.05)}.pcr-app .pcr-interaction{display:flex;align-items:center;margin:.75em -.2em 0}.pcr-app .pcr-interaction>*{margin:0 .2em}.pcr-app .pcr-interaction input{letter-spacing:.07em;font-size:.75em;text-align:center;cursor:pointer;color:#75797e;background:#f1f3f4;border-radius:.15em;transition:all .15s;padding:.45em .5em}.pcr-app .pcr-interaction input:hover{filter:brightness(.975)}.pcr-app .pcr-interaction input:focus{box-shadow:0 0 0 1px #f1f3f4,0 0 0 3px rgba(66,133,244,.75)}.pcr-app .pcr-interaction .pcr-result{color:#75797e;text-align:left;flex-grow:1;min-width:1em;transition:all .2s;border-radius:.15em;background:#f1f3f4;cursor:text}.pcr-app .pcr-interaction .pcr-result::selection{background:#4285f4;color:#fff}.pcr-app .pcr-interaction .pcr-type.active{color:#fff;background:#4285f4}.pcr-app .pcr-interaction .pcr-clear,.pcr-app .pcr-interaction .pcr-save{width:auto;color:#fff}.pcr-app .pcr-interaction .pcr-clear:hover,.pcr-app .pcr-interaction .pcr-save:hover{filter:brightness(.925)}.pcr-app .pcr-interaction .pcr-save{background:#4285f4}.pcr-app .pcr-interaction .pcr-clear{background:#f44250}.pcr-app .pcr-interaction .pcr-clear:focus{box-shadow:0 0 0 1px #f1f3f4,0 0 0 3px rgba(244,66,80,.75)}.pcr-app .pcr-selection{display:flex;justify-content:space-between;flex-grow:1}.pcr-app .pcr-selection .pcr-picker{position:absolute;height:18px;width:18px;border:2px solid #fff;border-radius:100%;user-select:none}.pcr-app .pcr-selection .pcr-color-preview{position:relative;z-index:1;width:2em;display:flex;flex-direction:column;justify-content:space-between;margin-right:.75em}.pcr-app .pcr-selection .pcr-color-preview:before{position:absolute;content:"";top:0;left:0;width:100%;height:100%;background:url('data:image/svg+xml;utf8, ');background-size:.5em;border-radius:.15em;z-index:-1}.pcr-app .pcr-selection .pcr-color-preview .pcr-last-color{cursor:pointer;transition:background-color .3s,box-shadow .3s;border-radius:.15em .15em 0 0;z-index:2}.pcr-app .pcr-selection .pcr-color-preview .pcr-current-color{border-radius:0 0 .15em .15em}.pcr-app .pcr-selection .pcr-color-preview .pcr-current-color,.pcr-app .pcr-selection .pcr-color-preview .pcr-last-color{background:currentColor;width:100%;height:50%}.pcr-app .pcr-selection .pcr-color-chooser,.pcr-app .pcr-selection .pcr-color-opacity,.pcr-app .pcr-selection .pcr-color-palette{position:relative;user-select:none;display:flex;flex-direction:column;cursor:grab;cursor:-moz-grab;cursor:-webkit-grab}.pcr-app .pcr-selection .pcr-color-chooser:active,.pcr-app .pcr-selection .pcr-color-opacity:active,.pcr-app .pcr-selection .pcr-color-palette:active{cursor:grabbing;cursor:-moz-grabbing;cursor:-webkit-grabbing}.pcr-app .pcr-selection .pcr-color-palette{width:100%;height:8em;z-index:1}.pcr-app .pcr-selection .pcr-color-palette .pcr-palette{flex-grow:1;border-radius:.15em}.pcr-app .pcr-selection .pcr-color-palette .pcr-palette:before{position:absolute;content:"";top:0;left:0;width:100%;height:100%;background:url('data:image/svg+xml;utf8, ');background-size:.5em;border-radius:.15em;z-index:-1}.pcr-app .pcr-selection .pcr-color-chooser,.pcr-app .pcr-selection .pcr-color-opacity{margin-left:.75em}.pcr-app .pcr-selection .pcr-color-chooser .pcr-picker,.pcr-app .pcr-selection .pcr-color-opacity .pcr-picker{left:50%;transform:translateX(-50%)}.pcr-app .pcr-selection .pcr-color-chooser .pcr-slider,.pcr-app .pcr-selection .pcr-color-opacity .pcr-slider{width:8px;flex-grow:1;border-radius:50em}.pcr-app .pcr-selection .pcr-color-chooser .pcr-slider{background:linear-gradient(180deg,red,#ff0,#0f0,#0ff,#00f,#f0f,red)}.pcr-app .pcr-selection .pcr-color-opacity .pcr-slider{background:linear-gradient(180deg,transparent,#000),url('data:image/svg+xml;utf8, ');background-size:100%,50%} -/*# sourceMappingURL=pickr.min.js.map*/ap*/ \ No newline at end of file +/*# sourceMappingURL=pickr.es5.min.js.map*/ \ No newline at end of file diff --git a/dist/pickr.min.js b/dist/pickr.min.js index 4bfe52d1..00f8d48c 100644 --- a/dist/pickr.min.js +++ b/dist/pickr.min.js @@ -1,3 +1,3 @@ -/*! Pickr 0.4.11 MIT | https://github.com/Simonwep/pickr */ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Pickr=e():t.Pickr=e()}(window,function(){return function(t){var e={};function n(o){if(e[o])return e[o].exports;var i=e[o]={i:o,l:!1,exports:{}};return t[o].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(o,i,function(e){return t[e]}.bind(null,i));return o},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=1)}([function(t,e,n){},function(t,e,n){"use strict";n.r(e);n(0);function o(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}const i=r.bind(null,"addEventListener"),s=r.bind(null,"removeEventListener");function r(t,e,n,i){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};return e instanceof HTMLCollection||e instanceof NodeList?e=Array.from(e):Array.isArray(e)||(e=[e]),Array.isArray(n)||(n=[n]),e.forEach(e=>n.forEach(n=>e[t](n,i,function(t){for(var e=1;e1&&void 0!==arguments[1]?arguments[1]:{};const o=c(e,"data-con"),i=c(e,"data-key");i&&(n[i]=e);const s=Array.from(e.children),r=o?n[o]={}:n;for(let e of s){const n=c(e,"data-arr");n?(r[n]||(r[n]=[])).push(e):t(e,r)}return n}(a(t))}function p(t){let e=t.path||t.composedPath&&t.composedPath();if(e)return e;let n=t.target.parentElement;for(e=[t.target,n];n=n.parentElement;)e.push(n);return e.push(document,window),e}function u(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const n=t=>t>="0"&&t<="9"||"-"===t||"."===t;function o(o){const i=t.value,s=t.selectionStart;let r=s,a="";for(let t=s-1;t>0&&n(i[t]);t--)a=i[t]+a,r--;for(let t=s,e=i.length;t0&&!isNaN(a)&&isFinite(a)){const n=o.deltaY<0?1:-1,s=o.ctrlKey?5*n:n;let c=Number(a)+s;!e&&c<0&&(c=0);const l=i.substr(0,r)+c+i.substring(r+a.length,i.length),p=r+String(c).length;t.value=l,t.focus(),t.setSelectionRange(p,p)}o.preventDefault(),t.dispatchEvent(new Event("input"))}i(t,"focus",()=>i(window,"wheel",o,{passive:!1})),i(t,"blur",()=>s(window,"wheel",o))}function h(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:" ";return(e-=t.length)<=0||!n.length?String(t):(e>n.length&&(n+=n.repeat(e/n.length)),n.slice(0,e)+String(t))}function d(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=[],o=!0,i=!1,s=void 0;try{for(var r,a=t[Symbol.iterator]();!(o=(r=a.next()).done)&&(n.push(r.value),!e||n.length!==e);o=!0);}catch(t){i=!0,s=t}finally{try{o||null==a.return||a.return()}finally{if(i)throw s}}return n}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}const f=Math.min,v=Math.max,y=Math.floor,g=Math.round;function m(t,e,n){e/=100,n/=100;let o=y(t=t/360*6),i=t-o,s=n*(1-e),r=n*(1-i*e),a=n*(1-(1-i)*e),c=o%6;return[255*[n,r,s,s,a,n][c],255*[a,n,n,r,s,s][c],255*[s,s,a,n,n,r][c]]}function b(t,e,n){let o,i,s;const r=f(t/=255,e/=255,n/=255),a=v(t,e,n),c=a-r;if(0===c)o=i=0;else{i=c/a;let s=((a-t)/6+c/2)/c,r=((a-e)/6+c/2)/c,l=((a-n)/6+c/2)/c;t===a?o=l-r:e===a?o=1/3+s-l:n===a&&(o=2/3+r-s),o<0?o+=1:o>1&&(o-=1)}return[360*o,100*i,100*(s=a)]}function _(t,e,n,o){return e/=100,n/=100,[...b(255*(1-f(1,(t/=100)*(1-(o/=100))+o)),255*(1-f(1,e*(1-o)+o)),255*(1-f(1,n*(1-o)+o)))]}function w(t,e,n){return e/=100,[t,2*(e*=(n/=100)<.5?n:1-n)/(n+e)*100,100*(n+e)]}function k(t){return b(...t.match(/.{2}/g).map(t=>parseInt(t,16)))}function A(t){t=t.match(/^[a-zA-Z]+$/)?function(t){const e=document.createElement("canvas").getContext("2d");return e.fillStyle=t,e.fillStyle}(t):t;const e={cmyk:/^cmyk[\D]+(\d+)[\D]+(\d+)[\D]+(\d+)[\D]+(\d+)/i,rgba:/^(rgb|rgba)[\D]+(\d+)[\D]+(\d+)[\D]+(\d+)[\D]*?([\d.]+|$)/i,hsla:/^(hsl|hsla)[\D]+(\d+)[\D]+(\d+)[\D]+(\d+)[\D]*?([\d.]+|$)/i,hsva:/^(hsv|hsva)[\D]+(\d+)[\D]+(\d+)[\D]+(\d+)[\D]*?([\d.]+|$)/i,hex:/^#?(([\dA-Fa-f]{3,4})|([\dA-Fa-f]{6})|([\dA-Fa-f]{8}))$/i},n=t=>t.map(t=>/^(|\d+)\.\d+|\d+$/.test(t)?Number(t):void 0);let o;for(const r in e)if(o=e[r].exec(t))switch(r){case"cmyk":{let t=d(n(o),5),e=t[1],i=t[2],s=t[3],a=t[4];if(e>100||i>100||s>100||a>100)break;return{values:[..._(e,i,s,a),1],type:r}}case"rgba":{let t=d(n(o),6),e=t[2],i=t[3],s=t[4],a=t[5],c=void 0===a?1:a;if(e>255||i>255||s>255||c<0||c>1)break;return{values:[...b(e,i,s),c],type:r}}case"hex":{const t=(t,e)=>[t.substring(0,e),t.substring(e,t.length)];let e,n=d(o,2)[1];if(3===n.length?n+="F":6===n.length&&(n+="FF"),4===n.length){var i=d(t(n,3).map(t=>t+t),2);n=i[0],e=i[1]}else if(8===n.length){var s=d(t(n,6),2);n=s[0],e=s[1]}return e=parseInt(e,16)/255,{values:[...k(n),e],type:r}}case"hsla":{let t=d(n(o),6),e=t[2],i=t[3],s=t[4],a=t[5],c=void 0===a?1:a;if(e>360||i>100||s>100||c<0||c>1)break;return{values:[...w(e,i,s),c],type:r}}case"hsva":{let t=d(n(o),6),e=t[2],i=t[3],s=t[4],a=t[5],c=void 0===a?1:a;if(e>360||i>100||s>100||c<0||c>1)break;return{values:[e,i,s,c],type:r}}}return{values:null,type:null}}function C(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;const i=Math.ceil,s={h:t,s:e,v:n,a:o,toHSVA(){const t=[s.h,s.s,s.v],e=t.map(i);return t.push(s.a),t.toString=(()=>"hsva(".concat(e[0],", ").concat(e[1],"%, ").concat(e[2],"%, ").concat(s.a.toFixed(1),")")),t},toHSLA(){const t=function(t,e,n){let o=(2-(e/=100))*(n/=100)/2;return 0!==o&&(e=1===o?0:o<.5?e*n/(2*o):e*n/(2-2*o)),[t,100*e,100*o]}(s.h,s.s,s.v),e=t.map(i);return t.push(s.a),t.toString=(()=>"hsla(".concat(e[0],", ").concat(e[1],"%, ").concat(e[2],"%, ").concat(s.a.toFixed(1),")")),t},toRGBA(){const t=m(s.h,s.s,s.v),e=t.map(i);return t.push(s.a),t.toString=(()=>"rgba(".concat(e[0],", ").concat(e[1],", ").concat(e[2],", ").concat(s.a.toFixed(1),")")),t},toCMYK(){const t=function(t,e,n){const o=m(t,e,n),i=o[0]/255,s=o[1]/255,r=o[2]/255;let a,c,l,p;return[100*(c=1===(a=f(1-i,1-s,1-r))?0:(1-i-a)/(1-a)),100*(l=1===a?0:(1-s-a)/(1-a)),100*(p=1===a?0:(1-r-a)/(1-a)),100*a]}(s.h,s.s,s.v),e=t.map(i);return t.toString=(()=>"cmyk(".concat(e[0],"%, ").concat(e[1],"%, ").concat(e[2],"%, ").concat(e[3],"%)")),t},toHEXA(){const t=(e=s.h,n=s.s,o=s.v,m(e,n,o).map(t=>h(g(t).toString(16),2,"0")));var e,n,o;return t.toString=(()=>{const e=s.a>=1?"":h(Number((255*s.a).toFixed(0)).toString(16).toUpperCase(),2,"0");return"#".concat(t.join("").toUpperCase()+e)}),t},clone:()=>C(s.h,s.s,s.v,s.a)};return s.toHEX=s.toHEXA,s}function S(t){const e={options:Object.assign({lockX:!1,lockY:!1,onchange:()=>0},t),_tapstart(t){i(document,["mouseup","touchend","touchcancel"],e._tapstop),i(document,["mousemove","touchmove"],e._tapmove),t.preventDefault(),e._tapmove(t)},_tapmove(t){const n=e.options,o=e.cache,i=n.element,s=e.options.wrapper.getBoundingClientRect();let r=0,a=0;if(t){const e=t&&t.touches&&t.touches[0];r=t?(e||t).clientX:0,a=t?(e||t).clientY:0,rs.left+s.width&&(r=s.left+s.width),as.top+s.height&&(a=s.top+s.height),r-=s.left,a-=s.top}else o&&(r=o.x*s.width,a=o.y*s.height);n.lockX||(i.style.left="calc(".concat(r/s.width*100,"% - ").concat(i.offsetWidth/2,"px)")),n.lockY||(i.style.top="calc(".concat(a/s.height*100,"% - ").concat(i.offsetWidth/2,"px)")),e.cache={x:r/s.width,y:a/s.height},n.onchange(r,a)},_tapstop(){s(document,["mouseup","touchend","touchcancel"],e._tapstop),s(document,["mousemove","touchmove"],e._tapmove)},trigger(){e._tapmove()},update(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const o=e.options.wrapper.getBoundingClientRect();e._tapmove({clientX:o.left+t,clientY:o.top+n})},destroy(){const t=e.options,n=e._tapstart;s([t.wrapper,t.element],"mousedown",n),s([t.wrapper,t.element],"touchstart",n,{passive:!1})}},n=e.options,o=e._tapstart;return i([n.wrapper,n.element],"mousedown",o),i([n.wrapper,n.element],"touchstart",o,{passive:!1}),e}function O(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t=Object.assign({onchange:()=>0,className:"",elements:[]},t);const e=i(t.elements,"click",e=>{t.elements.forEach(n=>n.classList[e.target===n?"add":"remove"](t.className)),t.onchange(e)});return{destroy:()=>s(...e)}}function E(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}class x{constructor(t){E(this,"_initializingActive",!0),E(this,"_recalc",!0),E(this,"_color",C()),E(this,"_lastColor",C()),E(this,"_swatchColors",[]),E(this,"_eventListener",{swatchselect:[],change:[],save:[],init:[]}),E(this,"_rePositioningPicker",(()=>{let t,e;return()=>{if(this.options.inline)return;const n=this._root,o=n.app,i=n.button,s=window,r=s.innerWidth,a=s.innerHeight,c=i.getBoundingClientRect(),l=o.getBoundingClientRect();e=a-(c.bottom+l.height+8)<0?c.top-l.height-8:c.bottom+8;const p={left:c.left+c.width-l.width,middle:-l.width/2+(c.left+c.width/2),right:c.left},u=p[this.options.position];t=t+u>r?p.left:u<0?p.right:u,Object.assign(o.style,{left:"".concat(t,"px"),top:"".concat(e,"px")})}})()),this.options=t=Object.assign({useAsButton:!1,disabled:!1,comparison:!0,components:{interaction:{}},strings:{},swatches:null,inline:!1,default:"fff",defaultRepresentation:null,position:"middle",adjustableNumbers:!0,showAlways:!1,closeWithKey:"Escape"},t);const e=t,n=e.swatches,o=e.inline,i=e.components;i.interaction||(i.interaction={});const s=i.preview,r=i.opacity,a=i.hue,c=i.palette;i.palette=c||s||r||a,o&&(t.showAlways=!0),this._preBuild(),this._buildComponents(),this._bindEvents(),this._finalBuild(),n&&n.length&&n.forEach(t=>this.addSwatch(t));const l=this._root.button;requestAnimationFrame(function e(){if(null===l.offsetParent&&l!==document.body)return requestAnimationFrame(e.bind(this));this.setColor(t.default),this._rePositioningPicker(),t.defaultRepresentation&&(this._representation=t.defaultRepresentation,this.setColorRepresentation(this._representation)),t.showAlways&&this.show(),this._initializingActive=!1,this._emit("init")}.bind(this))}_preBuild(){const t=this.options;"string"==typeof t.el&&(t.el=t.el.split(/>>/g).reduce((t,e,n,o)=>(t=t.querySelector(e),nt?"":'style="display:none" hidden',r=l('\n
\n \n '.concat(o?"":'','\n\n
\n
\n
\n \n
\n
\n\n
\n
\n
\n
\n\n
\n
\n
\n
\n\n
\n
\n
\n
\n
\n\n
\n\n
\n \n\n \n \n \n \n \n\n \n \n
\n
\n
\n ")),a=r.interaction;return a.options.find(t=>!t.hidden&&!t.classList.add("active")),a.type=(()=>a.options.find(t=>t.classList.contains("active"))),r}(t),t.useAsButton&&(this._root.button=t.el),document.body.appendChild(this._root.root)}_finalBuild(){const t=this.options,e=this._root;if(document.body.removeChild(e.root),t.inline){const n=t.el.parentElement;n.lastChild===t.el?n.appendChild(e.app):n.insertBefore(e.app,t.el.nextSibling)}else document.body.appendChild(e.app);t.useAsButton||t.el.parentNode.replaceChild(e.root,t.el),t.disabled&&this.disable(),t.comparison||(e.button.style.transition="none",t.useAsButton||(e.preview.lastColor.style.transition="none")),this.hide()}_buildComponents(){const t=this,e=this.options.components,n={palette:S({element:t._root.palette.picker,wrapper:t._root.palette.palette,onchange(n,o){if(!e.palette)return;const i=t._color,s=t._root,r=t.options;i.s=n/this.wrapper.offsetWidth*100,i.v=100-o/this.wrapper.offsetHeight*100,i.v<0&&(i.v=0);const a=i.toRGBA().toString();this.element.style.background=a,this.wrapper.style.background="\n linear-gradient(to top, rgba(0, 0, 0, ".concat(i.a,"), transparent), \n linear-gradient(to left, hsla(").concat(i.h,", 100%, 50%, ").concat(i.a,"), rgba(255, 255, 255, ").concat(i.a,"))\n "),r.comparison||(s.button.style.color=a,r.useAsButton||(s.preview.lastColor.style.color=a)),s.preview.currentColor.style.color=a,t._recalc&&t._updateOutput(),s.button.classList.remove("clear")}}),hue:S({lockX:!0,element:t._root.hue.picker,wrapper:t._root.hue.slider,onchange(o,i){e.hue&&e.palette&&(t._color.h=i/this.wrapper.offsetHeight*360,this.element.style.backgroundColor="hsl(".concat(t._color.h,", 100%, 50%)"),n.palette.trigger())}}),opacity:S({lockX:!0,element:t._root.opacity.picker,wrapper:t._root.opacity.slider,onchange(n,o){e.opacity&&e.palette&&(t._color.a=Math.round(o/this.wrapper.offsetHeight*100)/100,this.element.style.background="rgba(0, 0, 0, ".concat(t._color.a,")"),t.components.palette.trigger())}}),selectable:O({elements:t._root.interaction.options,className:"active",onchange(e){t._representation=e.target.getAttribute("data-type").toUpperCase(),t._updateOutput()}})};this.components=n}_bindEvents(){const t=this._root,e=this.options,n=[i(t.interaction.clear,"click",()=>this._clearColor()),i(t.preview.lastColor,"click",()=>this.setHSVA(...this._lastColor.toHSVA())),i(t.interaction.save,"click",()=>{!this.applyColor()&&!e.showAlways&&this.hide()}),i(t.interaction.result,["keyup","input"],t=>{this._recalc=!1,this.setColor(t.target.value,!0)&&!this._initializingActive&&this._emit("change",this._color),t.stopImmediatePropagation()}),i([t.palette.palette,t.palette.picker,t.hue.slider,t.hue.picker,t.opacity.slider,t.opacity.picker],["mousedown","touchstart"],()=>this._recalc=!0)];if(!e.showAlways){const o=e.closeWithKey;n.push(i(t.button,"click",()=>this.isOpen()?this.hide():this.show()),i(document,"keyup",t=>this.isOpen()&&(t.key===o||t.code===o)&&this.hide()),i(document,["touchstart","mousedown"],e=>{this.isOpen()&&!p(e).some(e=>e===t.app||e===t.button)&&this.hide()},{capture:!0}))}if(e.adjustableNumbers&&u(t.interaction.result,!1),!e.inline){let t;n.push(i(window,["scroll","wheel","resize"],()=>{this.isOpen()&&(this.hide(),t&&clearTimeout(t),t=setTimeout(()=>this.show(),250))}))}this._eventBindings=n}_updateOutput(){if(this._root.interaction.type()){const t="to".concat(this._root.interaction.type().getAttribute("data-type"));this._root.interaction.result.value="function"==typeof this._color[t]?this._color[t]().toString():""}this._initializingActive||this._emit("change",this._color)}_clearColor(){const t=this._root,e=this.options;e.useAsButton||(t.button.style.color="rgba(0, 0, 0, 0.15)"),t.button.classList.add("clear"),e.showAlways||this.hide(),this._initializingActive||this._emit("save",null)}_emit(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),o=1;ot(...n,this))}on(t,e){return"function"==typeof e&&"string"==typeof t&&t in this._eventListener&&this._eventListener[t].push(e),this}off(t,e){const n=this._eventListener[t];if(n){const t=n.indexOf(e);~t&&n.splice(t,1)}return this}addSwatch(t){const e=A(t).values;if(e){const t=this._swatchColors,n=this._root,o=C(...e),s=a(''));return n.swatches.appendChild(s),t.push({element:s,hsvaColorObject:o}),this._eventBindings.push(i(s,"click",()=>{this.setHSVA(...o.toHSVA(),!0),this._emit("swatchselect",o)})),!0}return!1}removeSwatch(t){if("number"==typeof t){const e=this._swatchColors[t];if(e){const n=e.element;return this._root.swatches.removeChild(n),this._swatchColors.splice(t,1),!0}}return!1}applyColor(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const e=this._root,n=e.preview,o=e.button,i=this._color.toRGBA().toString();n.lastColor.style.color=i,this.options.useAsButton||(o.style.color=i),o.classList.remove("clear"),this._lastColor=this._color.clone(),this._initializingActive||t||this._emit("save",this._color)}destroy(){this._eventBindings.forEach(t=>s(...t)),Object.keys(this.components).forEach(t=>this.components[t].destroy())}destroyAndRemove(){this.destroy();const t=this._root.root;t.parentElement.removeChild(t);const e=this._root.app;e.parentElement.removeChild(e);const n=this;Object.keys(n).forEach(t=>n[t]=null)}hide(){return this._root.app.classList.remove("visible"),this}show(){if(!this.options.disabled)return this._root.app.classList.add("visible"),this._rePositioningPicker(),this}isOpen(){return this._root.app.classList.contains("visible")}setHSVA(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:360,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,i=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const s=this._recalc;if(this._recalc=!1,t<0||t>360||e<0||e>100||n<0||n>100||o<0||o>1)return!1;const r=this.components,a=r.hue,c=r.opacity,l=r.palette,p=a.options.wrapper.offsetHeight*(t/360);a.update(0,p);const u=c.options.wrapper.offsetHeight*o;c.update(0,u);const h=l.options.wrapper,d=h.offsetWidth*(e/100),f=h.offsetHeight*(1-n/100);return l.update(d,f),this._color=C(t,e,n,o),this._recalc=s,this._recalc&&this._updateOutput(),i||this.applyColor(),!0}setColor(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(null===t)return this._clearColor(),!0;const n=A(t),o=n.values,i=n.type;if(o){const t=i.toUpperCase(),n=this._root.interaction.options,s=n.find(e=>e.getAttribute("data-type").startsWith(t));if(s&&!s.hidden)for(const t of n)t.classList[t===s?"add":"remove"]("active");return this.setHSVA(...o,e)}}setColorRepresentation(t){return t=t.toUpperCase(),!!this._root.interaction.options.find(e=>e.getAttribute("data-type").startsWith(t)&&!e.click())}getColorRepresentation(){return this._representation}getColor(){return this._color}getRoot(){return this._root}disable(){return this.hide(),this.options.disabled=!0,this._root.button.classList.add("disabled"),this}enable(){return this.options.disabled=!1,this._root.button.classList.remove("disabled"),this}}x.utils={once:(t,e,n,o)=>i(t,e,function t(){n.apply(this,arguments),this.removeEventListener(e,t)},o),on:i,off:s,eventPath:p,createElementFromString:a,adjustableInputNumbers:u,removeAttribute:c,createFromTemplate:l},x.create=(t=>new x(t)),x.version="0.4.11";e.default=x}]).default}); +/*! Pickr 0.5.0 MIT | https://github.com/Simonwep/pickr */ +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Pickr=e():t.Pickr=e()}(window,function(){return function(t){var e={};function n(o){if(e[o])return e[o].exports;var i=e[o]={i:o,l:!1,exports:{}};return t[o].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(o,i,function(e){return t[e]}.bind(null,i));return o},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=1)}([function(t,e,n){},function(t,e,n){"use strict";n.r(e);n(0);function o(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}const i=r.bind(null,"addEventListener"),s=r.bind(null,"removeEventListener");function r(t,e,n,i){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};return e instanceof HTMLCollection||e instanceof NodeList?e=Array.from(e):Array.isArray(e)||(e=[e]),Array.isArray(n)||(n=[n]),e.forEach(e=>n.forEach(n=>e[t](n,i,function(t){for(var e=1;e1&&void 0!==arguments[1]?arguments[1]:{};const o=c(e,"data-con"),i=c(e,"data-key");i&&(n[i]=e);const s=Array.from(e.children),r=o?n[o]={}:n;for(let e of s){const n=c(e,"data-arr");n?(r[n]||(r[n]=[])).push(e):t(e,r)}return n}(a(t))}function p(t){let e=t.path||t.composedPath&&t.composedPath();if(e)return e;let n=t.target.parentElement;for(e=[t.target,n];n=n.parentElement;)e.push(n);return e.push(document,window),e}function u(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const n=t=>t>="0"&&t<="9"||"-"===t||"."===t;function o(o){const i=t.value,s=t.selectionStart;let r=s,a="";for(let t=s-1;t>0&&n(i[t]);t--)a=i[t]+a,r--;for(let t=s,e=i.length;t0&&!isNaN(a)&&isFinite(a)){const n=o.deltaY<0?1:-1,s=o.ctrlKey?5*n:n;let c=Number(a)+s;!e&&c<0&&(c=0);const l=i.substr(0,r)+c+i.substring(r+a.length,i.length),p=r+String(c).length;t.value=l,t.focus(),t.setSelectionRange(p,p)}o.preventDefault(),t.dispatchEvent(new Event("input"))}i(t,"focus",()=>i(window,"wheel",o,{passive:!1})),i(t,"blur",()=>s(window,"wheel",o))}function h(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:" ";return(e-=t.length)<=0||!n.length?String(t):(e>n.length&&(n+=n.repeat(e/n.length)),n.slice(0,e)+String(t))}function d(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=[],o=!0,i=!1,s=void 0;try{for(var r,a=t[Symbol.iterator]();!(o=(r=a.next()).done)&&(n.push(r.value),!e||n.length!==e);o=!0);}catch(t){i=!0,s=t}finally{try{o||null==a.return||a.return()}finally{if(i)throw s}}return n}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}const f=Math.min,v=Math.max,y=Math.floor,g=Math.round;function m(t,e,n){e/=100,n/=100;let o=y(t=t/360*6),i=t-o,s=n*(1-e),r=n*(1-i*e),a=n*(1-(1-i)*e),c=o%6;return[255*[n,r,s,s,a,n][c],255*[a,n,n,r,s,s][c],255*[s,s,a,n,n,r][c]]}function b(t,e,n){let o,i,s;const r=f(t/=255,e/=255,n/=255),a=v(t,e,n),c=a-r;if(0===c)o=i=0;else{i=c/a;let s=((a-t)/6+c/2)/c,r=((a-e)/6+c/2)/c,l=((a-n)/6+c/2)/c;t===a?o=l-r:e===a?o=1/3+s-l:n===a&&(o=2/3+r-s),o<0?o+=1:o>1&&(o-=1)}return[360*o,100*i,100*(s=a)]}function _(t,e,n,o){return e/=100,n/=100,[...b(255*(1-f(1,(t/=100)*(1-(o/=100))+o)),255*(1-f(1,e*(1-o)+o)),255*(1-f(1,n*(1-o)+o)))]}function w(t,e,n){return e/=100,[t,2*(e*=(n/=100)<.5?n:1-n)/(n+e)*100,100*(n+e)]}function k(t){return b(...t.match(/.{2}/g).map(t=>parseInt(t,16)))}function A(t){t=t.match(/^[a-zA-Z]+$/)?function(t){const e=document.createElement("canvas").getContext("2d");return e.fillStyle=t,e.fillStyle}(t):t;const e={cmyk:/^cmyk[\D]+(\d+)[\D]+(\d+)[\D]+(\d+)[\D]+(\d+)/i,rgba:/^(rgb|rgba)[\D]+(\d+)[\D]+(\d+)[\D]+(\d+)[\D]*?([\d.]+|$)/i,hsla:/^(hsl|hsla)[\D]+(\d+)[\D]+(\d+)[\D]+(\d+)[\D]*?([\d.]+|$)/i,hsva:/^(hsv|hsva)[\D]+(\d+)[\D]+(\d+)[\D]+(\d+)[\D]*?([\d.]+|$)/i,hex:/^#?(([\dA-Fa-f]{3,4})|([\dA-Fa-f]{6})|([\dA-Fa-f]{8}))$/i},n=t=>t.map(t=>/^(|\d+)\.\d+|\d+$/.test(t)?Number(t):void 0);let o;for(const r in e)if(o=e[r].exec(t))switch(r){case"cmyk":{let t=d(n(o),5),e=t[1],i=t[2],s=t[3],a=t[4];if(e>100||i>100||s>100||a>100)break;return{values:[..._(e,i,s,a),1],type:r}}case"rgba":{let t=d(n(o),6),e=t[2],i=t[3],s=t[4],a=t[5],c=void 0===a?1:a;if(e>255||i>255||s>255||c<0||c>1)break;return{values:[...b(e,i,s),c],type:r}}case"hex":{const t=(t,e)=>[t.substring(0,e),t.substring(e,t.length)];let e,n=d(o,2)[1];if(3===n.length?n+="F":6===n.length&&(n+="FF"),4===n.length){var i=d(t(n,3).map(t=>t+t),2);n=i[0],e=i[1]}else if(8===n.length){var s=d(t(n,6),2);n=s[0],e=s[1]}return e=parseInt(e,16)/255,{values:[...k(n),e],type:r}}case"hsla":{let t=d(n(o),6),e=t[2],i=t[3],s=t[4],a=t[5],c=void 0===a?1:a;if(e>360||i>100||s>100||c<0||c>1)break;return{values:[...w(e,i,s),c],type:r}}case"hsva":{let t=d(n(o),6),e=t[2],i=t[3],s=t[4],a=t[5],c=void 0===a?1:a;if(e>360||i>100||s>100||c<0||c>1)break;return{values:[e,i,s,c],type:r}}}return{values:null,type:null}}function C(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;const i=Math.ceil,s={h:t,s:e,v:n,a:o,toHSVA(){const t=[s.h,s.s,s.v],e=t.map(i);return t.push(s.a),t.toString=(()=>"hsva(".concat(e[0],", ").concat(e[1],"%, ").concat(e[2],"%, ").concat(s.a.toFixed(1),")")),t},toHSLA(){const t=function(t,e,n){let o=(2-(e/=100))*(n/=100)/2;return 0!==o&&(e=1===o?0:o<.5?e*n/(2*o):e*n/(2-2*o)),[t,100*e,100*o]}(s.h,s.s,s.v),e=t.map(i);return t.push(s.a),t.toString=(()=>"hsla(".concat(e[0],", ").concat(e[1],"%, ").concat(e[2],"%, ").concat(s.a.toFixed(1),")")),t},toRGBA(){const t=m(s.h,s.s,s.v),e=t.map(i);return t.push(s.a),t.toString=(()=>"rgba(".concat(e[0],", ").concat(e[1],", ").concat(e[2],", ").concat(s.a.toFixed(1),")")),t},toCMYK(){const t=function(t,e,n){const o=m(t,e,n),i=o[0]/255,s=o[1]/255,r=o[2]/255;let a,c,l,p;return[100*(c=1===(a=f(1-i,1-s,1-r))?0:(1-i-a)/(1-a)),100*(l=1===a?0:(1-s-a)/(1-a)),100*(p=1===a?0:(1-r-a)/(1-a)),100*a]}(s.h,s.s,s.v),e=t.map(i);return t.toString=(()=>"cmyk(".concat(e[0],"%, ").concat(e[1],"%, ").concat(e[2],"%, ").concat(e[3],"%)")),t},toHEXA(){const t=(e=s.h,n=s.s,o=s.v,m(e,n,o).map(t=>h(g(t).toString(16),2,"0")));var e,n,o;return t.toString=(()=>{const e=s.a>=1?"":h(Number((255*s.a).toFixed(0)).toString(16).toUpperCase(),2,"0");return"#".concat(t.join("").toUpperCase()+e)}),t},clone:()=>C(s.h,s.s,s.v,s.a)};return s.toHEX=s.toHEXA,s}function S(t){const e={options:Object.assign({lockX:!1,lockY:!1,onchange:()=>0},t),_tapstart(t){i(document,["mouseup","touchend","touchcancel"],e._tapstop),i(document,["mousemove","touchmove"],e._tapmove),t.preventDefault(),e._tapmove(t)},_tapmove(t){const n=e.options,o=e.cache,i=n.element,s=e.options.wrapper.getBoundingClientRect();let r=0,a=0;if(t){const e=t&&t.touches&&t.touches[0];r=t?(e||t).clientX:0,a=t?(e||t).clientY:0,rs.left+s.width&&(r=s.left+s.width),as.top+s.height&&(a=s.top+s.height),r-=s.left,a-=s.top}else o&&(r=o.x*s.width,a=o.y*s.height);n.lockX||(i.style.left="calc(".concat(r/s.width*100,"% - ").concat(i.offsetWidth/2,"px)")),n.lockY||(i.style.top="calc(".concat(a/s.height*100,"% - ").concat(i.offsetWidth/2,"px)")),e.cache={x:r/s.width,y:a/s.height},n.onchange(r,a)},_tapstop(){s(document,["mouseup","touchend","touchcancel"],e._tapstop),s(document,["mousemove","touchmove"],e._tapmove)},trigger(){e._tapmove()},update(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const o=e.options.wrapper.getBoundingClientRect();e._tapmove({clientX:o.left+t,clientY:o.top+n})},destroy(){const t=e.options,n=e._tapstart;s([t.wrapper,t.element],"mousedown",n),s([t.wrapper,t.element],"touchstart",n,{passive:!1})}},n=e.options,o=e._tapstart;return i([n.wrapper,n.element],"mousedown",o),i([n.wrapper,n.element],"touchstart",o,{passive:!1}),e}function O(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t=Object.assign({onchange:()=>0,className:"",elements:[]},t);const e=i(t.elements,"click",e=>{t.elements.forEach(n=>n.classList[e.target===n?"add":"remove"](t.className)),t.onchange(e)});return{destroy:()=>s(...e)}}function E(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}class x{constructor(t){E(this,"_initializingActive",!0),E(this,"_recalc",!0),E(this,"_color",C()),E(this,"_lastColor",C()),E(this,"_swatchColors",[]),E(this,"_eventListener",{swatchselect:[],change:[],save:[],init:[]}),E(this,"_rePositioningPicker",(()=>{let t,e;return()=>{if(this.options.inline)return;const n=this._root,o=n.app,i=n.button,s=window,r=s.innerWidth,a=s.innerHeight,c=i.getBoundingClientRect(),l=o.getBoundingClientRect();e=a-(c.bottom+l.height+8)<0?c.top-l.height-8:c.bottom+8;const p={left:c.left+c.width-l.width,middle:-l.width/2+(c.left+c.width/2),right:c.left},u=p[this.options.position];t=t+u>r?p.left:u<0?p.right:u,Object.assign(o.style,{left:"".concat(t,"px"),top:"".concat(e,"px")})}})()),this.options=t=Object.assign({useAsButton:!1,disabled:!1,comparison:!0,components:{interaction:{}},strings:{},swatches:null,inline:!1,default:"fff",defaultRepresentation:null,position:"middle",adjustableNumbers:!0,showAlways:!1,closeWithKey:"Escape"},t);const e=t,n=e.swatches,o=e.inline,i=e.components;i.interaction||(i.interaction={});const s=i.preview,r=i.opacity,a=i.hue,c=i.palette;i.palette=c||s||r||a,o&&(t.showAlways=!0),this._preBuild(),this._buildComponents(),this._bindEvents(),this._finalBuild(),n&&n.length&&n.forEach(t=>this.addSwatch(t));const l=this._root.button;requestAnimationFrame(function e(){if(null===l.offsetParent&&l!==document.body)return requestAnimationFrame(e.bind(this));this.setColor(t.default),this._rePositioningPicker(),t.defaultRepresentation&&(this._representation=t.defaultRepresentation,this.setColorRepresentation(this._representation)),t.showAlways&&this.show(),this._initializingActive=!1,this._emit("init")}.bind(this))}_preBuild(){const t=this.options;"string"==typeof t.el&&(t.el=t.el.split(/>>/g).reduce((t,e,n,o)=>(t=t.querySelector(e),nt?"":'style="display:none" hidden',r=l('\n
\n \n '.concat(o?"":'','\n\n
\n
\n
\n \n
\n
\n\n
\n
\n
\n
\n\n
\n
\n
\n
\n\n
\n
\n
\n
\n
\n\n
\n\n
\n \n\n \n \n \n \n \n\n \n \n
\n
\n
\n ")),a=r.interaction;return a.options.find(t=>!t.hidden&&!t.classList.add("active")),a.type=(()=>a.options.find(t=>t.classList.contains("active"))),r}(t),t.useAsButton&&(this._root.button=t.el),document.body.appendChild(this._root.root)}_finalBuild(){const t=this.options,e=this._root;if(document.body.removeChild(e.root),t.inline){const n=t.el.parentElement;n.lastChild===t.el?n.appendChild(e.app):n.insertBefore(e.app,t.el.nextSibling)}else document.body.appendChild(e.app);t.useAsButton||t.el.parentNode.replaceChild(e.root,t.el),t.disabled&&this.disable(),t.comparison||(e.button.style.transition="none",t.useAsButton||(e.preview.lastColor.style.transition="none")),this.hide()}_buildComponents(){const t=this,e=this.options.components,n={palette:S({element:t._root.palette.picker,wrapper:t._root.palette.palette,onchange(n,o){if(!e.palette)return;const i=t._color,s=t._root,r=t.options;i.s=n/this.wrapper.offsetWidth*100,i.v=100-o/this.wrapper.offsetHeight*100,i.v<0&&(i.v=0);const a=i.toRGBA().toString();this.element.style.background=a,this.wrapper.style.background="\n linear-gradient(to top, rgba(0, 0, 0, ".concat(i.a,"), transparent), \n linear-gradient(to left, hsla(").concat(i.h,", 100%, 50%, ").concat(i.a,"), rgba(255, 255, 255, ").concat(i.a,"))\n "),r.comparison||(s.button.style.color=a,r.useAsButton||(s.preview.lastColor.style.color=a)),s.preview.currentColor.style.color=a,t._recalc&&t._updateOutput(),s.button.classList.remove("clear")}}),hue:S({lockX:!0,element:t._root.hue.picker,wrapper:t._root.hue.slider,onchange(o,i){e.hue&&e.palette&&(t._color.h=i/this.wrapper.offsetHeight*360,this.element.style.backgroundColor="hsl(".concat(t._color.h,", 100%, 50%)"),n.palette.trigger())}}),opacity:S({lockX:!0,element:t._root.opacity.picker,wrapper:t._root.opacity.slider,onchange(n,o){e.opacity&&e.palette&&(t._color.a=Math.round(o/this.wrapper.offsetHeight*100)/100,this.element.style.background="rgba(0, 0, 0, ".concat(t._color.a,")"),t.components.palette.trigger())}}),selectable:O({elements:t._root.interaction.options,className:"active",onchange(e){t._representation=e.target.getAttribute("data-type").toUpperCase(),t._updateOutput()}})};this.components=n}_bindEvents(){const t=this._root,e=this.options,n=[i(t.interaction.clear,"click",()=>this._clearColor()),i(t.preview.lastColor,"click",()=>this.setHSVA(...this._lastColor.toHSVA())),i(t.interaction.save,"click",()=>{!this.applyColor()&&!e.showAlways&&this.hide()}),i(t.interaction.result,["keyup","input"],t=>{this._recalc=!1,this.setColor(t.target.value,!0)&&!this._initializingActive&&this._emit("change",this._color),t.stopImmediatePropagation()}),i([t.palette.palette,t.palette.picker,t.hue.slider,t.hue.picker,t.opacity.slider,t.opacity.picker],["mousedown","touchstart"],()=>this._recalc=!0)];if(!e.showAlways){const o=e.closeWithKey;n.push(i(t.button,"click",()=>this.isOpen()?this.hide():this.show()),i(document,"keyup",t=>this.isOpen()&&(t.key===o||t.code===o)&&this.hide()),i(document,["touchstart","mousedown"],e=>{this.isOpen()&&!p(e).some(e=>e===t.app||e===t.button)&&this.hide()},{capture:!0}))}if(e.adjustableNumbers&&u(t.interaction.result,!1),!e.inline){let t;n.push(i(window,["scroll","wheel","resize"],()=>{this.isOpen()&&(this.hide(),t&&clearTimeout(t),t=setTimeout(()=>this.show(),250))}))}this._eventBindings=n}_updateOutput(){if(this._root.interaction.type()){const t="to".concat(this._root.interaction.type().getAttribute("data-type"));this._root.interaction.result.value="function"==typeof this._color[t]?this._color[t]().toString():""}this._initializingActive||this._emit("change",this._color)}_clearColor(){const t=this._root,e=this.options;e.useAsButton||(t.button.style.color="rgba(0, 0, 0, 0.15)"),t.button.classList.add("clear"),e.showAlways||this.hide(),this._initializingActive||this._emit("save",null)}_emit(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),o=1;ot(...n,this))}on(t,e){return"function"==typeof e&&"string"==typeof t&&t in this._eventListener&&this._eventListener[t].push(e),this}off(t,e){const n=this._eventListener[t];if(n){const t=n.indexOf(e);~t&&n.splice(t,1)}return this}addSwatch(t){const e=A(t).values;if(e){const t=this._swatchColors,n=this._root,o=C(...e),s=a(''));return n.swatches.appendChild(s),t.push({element:s,hsvaColorObject:o}),this._eventBindings.push(i(s,"click",()=>{this.setHSVA(...o.toHSVA(),!0),this._emit("swatchselect",o)})),!0}return!1}removeSwatch(t){if("number"==typeof t){const e=this._swatchColors[t];if(e){const n=e.element;return this._root.swatches.removeChild(n),this._swatchColors.splice(t,1),!0}}return!1}applyColor(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const e=this._root,n=e.preview,o=e.button,i=this._color.toRGBA().toString();n.lastColor.style.color=i,this.options.useAsButton||(o.style.color=i),o.classList.remove("clear"),this._lastColor=this._color.clone(),this._initializingActive||t||this._emit("save",this._color)}destroy(){this._eventBindings.forEach(t=>s(...t)),Object.keys(this.components).forEach(t=>this.components[t].destroy())}destroyAndRemove(){this.destroy();const t=this._root.root;t.parentElement.removeChild(t);const e=this._root.app;e.parentElement.removeChild(e);const n=this;Object.keys(n).forEach(t=>n[t]=null)}hide(){return this._root.app.classList.remove("visible"),this}show(){if(!this.options.disabled)return this._root.app.classList.add("visible"),this._rePositioningPicker(),this}isOpen(){return this._root.app.classList.contains("visible")}setHSVA(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:360,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,i=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const s=this._recalc;if(this._recalc=!1,t<0||t>360||e<0||e>100||n<0||n>100||o<0||o>1)return!1;const r=this.components,a=r.hue,c=r.opacity,l=r.palette,p=a.options.wrapper.offsetHeight*(t/360);a.update(0,p);const u=c.options.wrapper.offsetHeight*o;c.update(0,u);const h=l.options.wrapper,d=h.offsetWidth*(e/100),f=h.offsetHeight*(1-n/100);return l.update(d,f),this._color=C(t,e,n,o),this._recalc=s,this._recalc&&this._updateOutput(),i||this.applyColor(),!0}setColor(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(null===t)return this._clearColor(),!0;const n=A(t),o=n.values,i=n.type;if(o){const t=i.toUpperCase(),n=this._root.interaction.options,s=n.find(e=>e.getAttribute("data-type").startsWith(t));if(s&&!s.hidden)for(const t of n)t.classList[t===s?"add":"remove"]("active");return this.setHSVA(...o,e)}}setColorRepresentation(t){return t=t.toUpperCase(),!!this._root.interaction.options.find(e=>e.getAttribute("data-type").startsWith(t)&&!e.click())}getColorRepresentation(){return this._representation}getColor(){return this._color}getRoot(){return this._root}disable(){return this.hide(),this.options.disabled=!0,this._root.button.classList.add("disabled"),this}enable(){return this.options.disabled=!1,this._root.button.classList.remove("disabled"),this}}x.utils={once:(t,e,n,o)=>i(t,e,function t(){n.apply(this,arguments),this.removeEventListener(e,t)},o),on:i,off:s,eventPath:p,createElementFromString:a,adjustableInputNumbers:u,removeAttribute:c,createFromTemplate:l},x.create=(t=>new x(t)),x.version="0.5.0";e.default=x}]).default}); //# sourceMappingURL=pickr.min.js.map \ No newline at end of file diff --git a/dist/pickr.min.js.map b/dist/pickr.min.js.map index 4776b99c..513deffe 100644 --- a/dist/pickr.min.js.map +++ b/dist/pickr.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap","webpack:///./src/js/lib/utils.js","webpack:///./src/js/lib/color.js","webpack:///./src/js/lib/hsvacolor.js","webpack:///./src/js/helper/moveable.js","webpack:///./src/js/helper/selectable.js","webpack:///./src/js/pickr.js"],"names":["root","factory","exports","module","define","amd","window","installedModules","__webpack_require__","moduleId","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","on","eventListener","off","method","elements","events","fn","options","arguments","length","undefined","HTMLCollection","NodeList","Array","from","isArray","forEach","el","ev","_objectSpread","capture","slice","createElementFromString","html","div","document","createElement","innerHTML","trim","firstElementChild","removeAttribute","getAttribute","createFromTemplate","str","resolve","element","base","con","children","subtree","child","arr","push","eventPath","evt","path","composedPath","target","parentElement","adjustableInputNumbers","negative","isNumChar","handleScroll","e","val","selectionStart","numStart","num","isNaN","isFinite","mul","deltaY","inc","ctrlKey","newNum","Number","newStr","substr","substring","curPos","String","focus","setSelectionRange","preventDefault","dispatchEvent","Event","passive","padStart","string","maxLength","fillString","repeat","min","Math","max","floor","round","hsvToRgb","h","v","f","q","mod","rgbToHsv","g","b","minVal","maxVal","delta","dr","dg","db","cmykToHsv","y","k","hslToHsv","hexToHsv","hex","match","map","parseInt","parseToHSV","ctx","getContext","fillStyle","standardizeColor","regex","cmyk","rgba","hsla","hsva","numarize","array","test","type","exec","_numarize2","_slicedToArray","values","_numarize4","_numarize4$","a","splitAt","alpha","_splitAt$map2","_splitAt2","_numarize6","_numarize6$","_numarize8","_numarize8$","HSVaColor","ceil","that","toHSVA","rhsva","toString","concat","toFixed","toHSLA","Color","rhsla","toRGBA","rrgba","toCMYK","rgb","rcmyk","toHEXA","toUpperCase","join","clone","toHEX","Moveable","opt","assign","lockX","lockY","onchange","_tapstart","_","_tapstop","_tapmove","cache","wrapper","getBoundingClientRect","x","touch","touches","clientX","clientY","left","width","top","height","style","offsetWidth","trigger","update","wrapperRect","destroy","Selectable","className","onTap","classList","Pickr","constructor","pickr_defineProperty","this","swatchselect","change","save","init","inline","_this$_root","_root","app","button","_window","innerWidth","innerHeight","bb","ab","bottom","pos","middle","right","wantedLeft","position","useAsButton","disabled","comparison","components","interaction","strings","swatches","default","defaultRepresentation","adjustableNumbers","showAlways","closeWithKey","_opt","preview","opacity","hue","palette","_preBuild","_buildComponents","_bindEvents","_finalBuild","color","addSwatch","requestAnimationFrame","cb","offsetParent","body","setColor","_rePositioningPicker","_representation","setColorRepresentation","show","_initializingActive","_emit","split","reduce","pv","cv","ci","querySelector","shadowRoot","hidden","keys","input","clear","int","find","add","contains","appendChild","removeChild","lastChild","insertBefore","nextSibling","parentNode","replaceChild","disable","transition","lastColor","hide","inst","comp","picker","_color","offsetHeight","cssRGBaString","background","currentColor","_recalc","_updateOutput","remove","slider","backgroundColor","selectable","eventBindings","_clearColor","setHSVA","_lastColor","applyColor","result","stopImmediatePropagation","ck","isOpen","code","some","updateTimeout","clearTimeout","setTimeout","_eventBindings","event","_len","args","_key","_eventListener","callBacks","index","indexOf","splice","_swatchColors","hsvaColorObject","removeSwatch","swatchColor","silent","_this$_root2","destroyAndRemove","pickr","recalc","_this$components","hueY","opacityY","pickerWrapper","pickerX","pickerY","_Color$parseToHSV2","utype","startsWith","click","getColorRepresentation","getColor","getRoot","enable","utils","once","helper","apply","removeEventListener","version"],"mappings":";CAAA,SAAAA,EAAAC,GACA,iBAAAC,SAAA,iBAAAC,OACAA,OAAAD,QAAAD,IACA,mBAAAG,eAAAC,IACAD,OAAA,GAAAH,GACA,iBAAAC,QACAA,QAAA,MAAAD,IAEAD,EAAA,MAAAC,IARA,CASCK,OAAA,WACD,mBCTA,IAAAC,EAAA,GAGA,SAAAC,EAAAC,GAGA,GAAAF,EAAAE,GACA,OAAAF,EAAAE,GAAAP,QAGA,IAAAC,EAAAI,EAAAE,GAAA,CACAC,EAAAD,EACAE,GAAA,EACAT,QAAA,IAUA,OANAU,EAAAH,GAAAI,KAAAV,EAAAD,QAAAC,IAAAD,QAAAM,GAGAL,EAAAQ,GAAA,EAGAR,EAAAD,QA0DA,OArDAM,EAA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,EAASxC,EAAQgQ,KAAKtP,GAAMA,EAAGc,aAAa,aAAa6S,WAAWD,IAG1E,GAAI5R,IAAWA,EAAOmN,OAClB,IAAK,MAAMjP,KAAMV,EACbU,EAAG+K,UAAU/K,IAAO8B,EAAS,MAAQ,UAAU,UAIvD,OAAOqJ,KAAKiG,WAAWrK,EAAQ+L,IAUvCxE,uBAAuB3H,GAMnB,OAHAA,EAAOA,EAAKiC,gBAGHuC,KAAKO,MAAMkB,YAAYtN,QAAQgQ,KAAK9K,GAAKA,EAAE1D,aAAa,aAAa6S,WAAWhN,KAAUnC,EAAEoP,SAOzGC,yBACI,OAAO1I,KAAKkD,gBAMhByF,WACI,OAAO3I,KAAKoF,OAMhBwD,UACI,OAAO5I,KAAKO,MAMhBsE,UAII,OAHA7E,KAAKgF,OACLhF,KAAK7L,QAAQmN,UAAW,EACxBtB,KAAKO,MAAME,OAAOb,UAAUwE,IAAI,YACzBpE,KAMX6I,SAGI,OAFA7I,KAAK7L,QAAQmN,UAAW,EACxBtB,KAAKO,MAAME,OAAOb,UAAU+F,OAAO,YAC5B3F,MAiEfH,EAAMiJ,MAAQ,CACVC,KLvzBgB,CAAChT,EAAS+Q,EAAO5S,EAAIC,IAAYP,EAAGmC,EAAS+Q,EAAO,SAASkC,IAC7E9U,EAAG+U,MAAMjJ,KAAM5L,WACf4L,KAAKkJ,oBAAoBpC,EAAOkC,IACjC7U,GKqzBCP,GAAIwK,EACJtK,IAAKsK,EACL7H,UAAW6H,EACXlJ,wBAAyBkJ,EACzBvH,uBAAwBuH,EACxB1I,gBAAiB0I,EACjBxI,mBAAoBwI,GAIxByB,EAAM3M,OAAUiB,IAAY,IAAI0L,EAAM1L,IAGtC0L,EAAMsJ,QAAU,SACDtJ","file":"pickr.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"Pickr\"] = factory();\n\telse\n\t\troot[\"Pickr\"] = factory();\n})(window, function() {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 1);\n","/**\n * Add an eventlistener which will be fired only once.\n *\n * @param element Target element\n * @param event Event name\n * @param fn Callback\n * @param options Optional options\n * @return Array passed arguments\n */\nexport const once = (element, event, fn, options) => on(element, event, function helper() {\n fn.apply(this, arguments);\n this.removeEventListener(event, helper);\n}, options);\n\n/**\n * Add event(s) to element(s).\n * @param elements DOM-Elements\n * @param events Event names\n * @param fn Callback\n * @param options Optional options\n * @return Array passed arguments\n */\nexport const on = eventListener.bind(null, 'addEventListener');\n\n/**\n * Remove event(s) from element(s).\n * @param elements DOM-Elements\n * @param events Event names\n * @param fn Callback\n * @param options Optional options\n * @return Array passed arguments\n */\nexport const off = eventListener.bind(null, 'removeEventListener');\n\nfunction eventListener(method, elements, events, fn, options = {}) {\n\n // Normalize array\n if (elements instanceof HTMLCollection || elements instanceof NodeList) {\n elements = Array.from(elements);\n } else if (!Array.isArray(elements)) {\n elements = [elements];\n }\n\n if (!Array.isArray(events)) {\n events = [events];\n }\n\n elements.forEach(el =>\n events.forEach(ev =>\n el[method](ev, fn, {capture: false, ...options})\n )\n );\n\n return Array.prototype.slice.call(arguments, 1);\n}\n\n/**\n * Creates an DOM-Element out of a string (Single element).\n * @param html HTML representing a single element\n * @returns {Element | null} The element.\n */\nexport function createElementFromString(html) {\n const div = document.createElement('div');\n div.innerHTML = html.trim();\n return div.firstElementChild;\n}\n\n/**\n * Removes an attribute from a HTMLElement and returns the value.\n * @param el\n * @param name\n * @return {string}\n */\nexport function removeAttribute(el, name) {\n const value = el.getAttribute(name);\n el.removeAttribute(name);\n return value;\n}\n\n/**\n * Creates a new html element, every element which has\n * a 'data-key' attribute will be saved in a object (which will be returned)\n * where the value of 'data-key' ist the object-key and the value the HTMLElement.\n *\n * It's possible to create a hierarchy if you add a 'data-con' attribute. Every\n * sibling will be added to the object which will get the name from the 'data-con' attribute.\n *\n * If you want to create an Array out of multiple elements, you can use the 'data-arr' attribute,\n * the value defines the key and all elements, which has the same parent and the same 'data-arr' attribute,\n * would be added to it.\n *\n * @param str - The HTML String.\n */\nexport function createFromTemplate(str) {\n\n // Recursive function to resolve template\n function resolve(element, base = {}) {\n\n // Check key and container attribute\n const con = removeAttribute(element, 'data-con');\n const key = removeAttribute(element, 'data-key');\n\n // Check and save element\n if (key) {\n base[key] = element;\n }\n\n // Check all children\n const children = Array.from(element.children);\n const subtree = con ? (base[con] = {}) : base;\n for (let child of children) {\n\n // Check if element should be saved as array\n const arr = removeAttribute(child, 'data-arr');\n if (arr) {\n\n // Check if there is already an array and add element\n (subtree[arr] || (subtree[arr] = [])).push(child);\n } else {\n resolve(child, subtree);\n }\n }\n\n return base;\n }\n\n return resolve(createElementFromString(str));\n}\n\n/**\n * Polyfill for safari & firefox for the eventPath event property.\n * @param evt The event object.\n * @return [String] event path.\n */\nexport function eventPath(evt) {\n let path = evt.path || (evt.composedPath && evt.composedPath());\n if (path) return path;\n\n let el = evt.target.parentElement;\n path = [evt.target, el];\n while (el = el.parentElement) path.push(el);\n\n path.push(document, window);\n return path;\n}\n\n/**\n * Creates the ability to change numbers in an input field with the scroll-wheel.\n * @param el\n * @param negative\n */\nexport function adjustableInputNumbers(el, negative = true) {\n\n // Check if a char represents a number\n const isNumChar = c => (c >= '0' && c <= '9') || c === '-' || c === '.';\n\n function handleScroll(e) {\n const val = el.value;\n const off = el.selectionStart;\n let numStart = off;\n let num = ''; // Will be the number as string\n\n // Look back\n for (let i = off - 1; i > 0 && isNumChar(val[i]); i--) {\n num = val[i] + num;\n numStart--; // Find start of number\n }\n\n // Look forward\n for (let i = off, n = val.length; i < n && isNumChar(val[i]); i++) {\n num += val[i];\n }\n\n // Check if number is valid\n if (num.length > 0 && !isNaN(num) && isFinite(num)) {\n\n const mul = e.deltaY < 0 ? 1 : -1;\n const inc = e.ctrlKey ? mul * 5 : mul;\n let newNum = Number(num) + inc;\n\n if (!negative && newNum < 0) {\n newNum = 0;\n }\n\n const newStr = val.substr(0, numStart) + newNum + val.substring(numStart + num.length, val.length);\n const curPos = numStart + String(newNum).length;\n\n // Update value and set cursor\n el.value = newStr;\n el.focus();\n el.setSelectionRange(curPos, curPos);\n }\n\n // Prevent default\n e.preventDefault();\n\n // Trigger input event\n el.dispatchEvent(new Event('input'));\n }\n\n // Bind events\n on(el, 'focus', () => on(window, 'wheel', handleScroll, {passive: false}));\n on(el, 'blur', () => off(window, 'wheel', handleScroll));\n}\n\n/**\n * Cross browser padStart implementation\n * @param string\n * @param maxLength\n * @param fillString\n * @returns {string}\n */\nexport function padStart(string, maxLength, fillString = ' ') {\n maxLength = maxLength - string.length;\n\n if (maxLength <= 0 || !fillString.length) {\n return String(string);\n } else {\n\n if (maxLength > fillString.length) {\n fillString += fillString.repeat(maxLength / fillString.length);\n }\n\n return fillString.slice(0, maxLength) + String(string);\n }\n}\n","import {padStart} from '../lib/utils';\n\n// Shorthands\nconst {min, max, floor, round} = Math;\n\n/**\n * Tries to convert a color name to rgb/a hex representation\n * @param name\n * @returns {string | CanvasGradient | CanvasPattern}\n */\nfunction standardizeColor(name) {\n const ctx = document.createElement('canvas').getContext('2d');\n ctx.fillStyle = name;\n return ctx.fillStyle;\n}\n\n/**\n * Convert HSV spectrum to RGB.\n * @param h Hue\n * @param s Saturation\n * @param v Value\n * @returns {number[]} Array with rgb values.\n */\nexport function hsvToRgb(h, s, v) {\n h = (h / 360) * 6;\n s /= 100;\n v /= 100;\n\n let i = floor(h);\n\n let f = h - i;\n let p = v * (1 - s);\n let q = v * (1 - f * s);\n let t = v * (1 - (1 - f) * s);\n\n let mod = i % 6;\n let r = [v, q, p, p, t, v][mod];\n let g = [t, v, v, q, p, p][mod];\n let b = [p, p, t, v, v, q][mod];\n\n return [\n r * 255,\n g * 255,\n b * 255\n ];\n}\n\n/**\n * Convert HSV spectrum to Hex.\n * @param h Hue\n * @param s Saturation\n * @param v Value\n * @returns {string[]} Hex values\n */\nexport function hsvToHex(h, s, v) {\n return hsvToRgb(h, s, v).map(v =>\n padStart(round(v).toString(16), 2, '0')\n );\n}\n\n/**\n * Convert HSV spectrum to CMYK.\n * @param h Hue\n * @param s Saturation\n * @param v Value\n * @returns {number[]} CMYK values\n */\nexport function hsvToCmyk(h, s, v) {\n const rgb = hsvToRgb(h, s, v);\n const r = rgb[0] / 255;\n const g = rgb[1] / 255;\n const b = rgb[2] / 255;\n\n let k, c, m, y;\n\n k = min(1 - r, 1 - g, 1 - b);\n\n c = k === 1 ? 0 : (1 - r - k) / (1 - k);\n m = k === 1 ? 0 : (1 - g - k) / (1 - k);\n y = k === 1 ? 0 : (1 - b - k) / (1 - k);\n\n return [\n c * 100,\n m * 100,\n y * 100,\n k * 100\n ];\n}\n\n/**\n * Convert HSV spectrum to HSL.\n * @param h Hue\n * @param s Saturation\n * @param v Value\n * @returns {number[]} HSL values\n */\nexport function hsvToHsl(h, s, v) {\n s /= 100, v /= 100;\n\n let l = (2 - s) * v / 2;\n\n if (l !== 0) {\n if (l === 1) {\n s = 0;\n } else if (l < 0.5) {\n s = s * v / (l * 2);\n } else {\n s = s * v / (2 - l * 2);\n }\n }\n\n return [\n h,\n s * 100,\n l * 100\n ];\n}\n\n/**\n * Convert RGB to HSV.\n * @param r Red\n * @param g Green\n * @param b Blue\n * @return {number[]} HSV values.\n */\nfunction rgbToHsv(r, g, b) {\n r /= 255, g /= 255, b /= 255;\n\n let h, s, v;\n const minVal = min(r, g, b);\n const maxVal = max(r, g, b);\n const delta = maxVal - minVal;\n\n v = maxVal;\n if (delta === 0) {\n h = s = 0;\n } else {\n s = delta / maxVal;\n let dr = (((maxVal - r) / 6) + (delta / 2)) / delta;\n let dg = (((maxVal - g) / 6) + (delta / 2)) / delta;\n let db = (((maxVal - b) / 6) + (delta / 2)) / delta;\n\n if (r === maxVal) {\n h = db - dg;\n } else if (g === maxVal) {\n h = (1 / 3) + dr - db;\n } else if (b === maxVal) {\n h = (2 / 3) + dg - dr;\n }\n\n if (h < 0) {\n h += 1;\n } else if (h > 1) {\n h -= 1;\n }\n }\n\n return [\n h * 360,\n s * 100,\n v * 100\n ];\n}\n\n/**\n * Convert CMYK to HSV.\n * @param c Cyan\n * @param m Magenta\n * @param y Yellow\n * @param k Key (Black)\n * @return {number[]} HSV values.\n */\nfunction cmykToHsv(c, m, y, k) {\n c /= 100, m /= 100, y /= 100, k /= 100;\n\n const r = (1 - min(1, c * (1 - k) + k)) * 255;\n const g = (1 - min(1, m * (1 - k) + k)) * 255;\n const b = (1 - min(1, y * (1 - k) + k)) * 255;\n\n return [...rgbToHsv(r, g, b)];\n}\n\n/**\n * Convert HSL to HSV.\n * @param h Hue\n * @param s Saturation\n * @param l Lightness\n * @return {number[]} HSV values.\n */\nfunction hslToHsv(h, s, l) {\n s /= 100, l /= 100;\n s *= l < 0.5 ? l : 1 - l;\n\n let ns = (2 * s / (l + s)) * 100;\n let v = (l + s) * 100;\n return [h, ns, v];\n}\n\n/**\n * Convert HEX to HSV.\n * @param hex Hexadecimal string of rgb colors, can have length 3 or 6.\n * @return {number[]} HSV values.\n */\nfunction hexToHsv(hex) {\n return rgbToHsv(...hex.match(/.{2}/g).map(v => parseInt(v, 16)));\n}\n\n/**\n * Try's to parse a string which represents a color to a HSV array.\n * Current supported types are cmyk, rgba, hsla and hexadecimal.\n * @param str\n * @return {*}\n */\nexport function parseToHSV(str) {\n\n // Check if string is a color-name\n str = str.match(/^[a-zA-Z]+$/) ? standardizeColor(str) : str;\n\n // Regular expressions to match different types of color represention\n const regex = {\n cmyk: /^cmyk[\\D]+(\\d+)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]+(\\d+)/i,\n rgba: /^(rgb|rgba)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]*?([\\d.]+|$)/i,\n hsla: /^(hsl|hsla)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]*?([\\d.]+|$)/i,\n hsva: /^(hsv|hsva)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]*?([\\d.]+|$)/i,\n hex: /^#?(([\\dA-Fa-f]{3,4})|([\\dA-Fa-f]{6})|([\\dA-Fa-f]{8}))$/i\n };\n\n /**\n * Takes an Array of any type, convert strings which represents\n * a number to a number an anything else to undefined.\n * @param array\n * @return {*}\n */\n const numarize = array => array.map(v => /^(|\\d+)\\.\\d+|\\d+$/.test(v) ? Number(v) : undefined);\n\n let match;\n for (const type in regex) {\n\n // Check if current scheme passed\n if (!(match = regex[type].exec(str)))\n continue;\n\n // Try to convert\n switch (type) {\n case 'cmyk': {\n let [, c, m, y, k] = numarize(match);\n\n if (c > 100 || m > 100 || y > 100 || k > 100)\n break;\n\n return {values: [...cmykToHsv(c, m, y, k), 1], type};\n }\n case 'rgba': {\n let [, , r, g, b, a = 1] = numarize(match);\n\n if (r > 255 || g > 255 || b > 255 || a < 0 || a > 1)\n break;\n\n return {values: [...rgbToHsv(r, g, b), a], type};\n }\n case 'hex': {\n const splitAt = (s, i) => [s.substring(0, i), s.substring(i, s.length)];\n let [, hex] = match;\n\n // Fill up opacity if not declared\n if (hex.length === 3) {\n hex += 'F';\n } else if (hex.length === 6) {\n hex += 'FF';\n }\n\n let alpha;\n if (hex.length === 4) {\n [hex, alpha] = splitAt(hex, 3).map(v => v + v);\n } else if (hex.length === 8) {\n [hex, alpha] = splitAt(hex, 6);\n }\n\n // Convert 0 - 255 to 0 - 1 for opacity\n alpha = parseInt(alpha, 16) / 255;\n return {values: [...hexToHsv(hex), alpha], type};\n }\n case 'hsla': {\n let [, , h, s, l, a = 1] = numarize(match);\n\n if (h > 360 || s > 100 || l > 100 || a < 0 || a > 1)\n break;\n\n return {values: [...hslToHsv(h, s, l), a], type};\n }\n case 'hsva': {\n let [, , h, s, v, a = 1] = numarize(match);\n\n if (h > 360 || s > 100 || v > 100 || a < 0 || a > 1)\n break;\n\n return {values: [h, s, v, a], type};\n }\n }\n }\n\n return {values: null, type: null};\n}\n","import {padStart} from '../lib/utils';\nimport * as Color from './color';\n\n/**\n * Simple class which holds the properties\n * of the color represention model hsla (hue saturation lightness alpha)\n */\nexport function HSVaColor(h = 0, s = 0, v = 0, a = 1) {\n\n const ceil = Math.ceil;\n const that = {\n h, s, v, a,\n\n toHSVA() {\n const hsva = [that.h, that.s, that.v];\n const rhsva = hsva.map(ceil);\n\n hsva.push(that.a);\n hsva.toString = () => `hsva(${rhsva[0]}, ${rhsva[1]}%, ${rhsva[2]}%, ${that.a.toFixed(1)})`;\n return hsva;\n },\n\n toHSLA() {\n const hsla = Color.hsvToHsl(that.h, that.s, that.v);\n const rhsla = hsla.map(ceil);\n\n hsla.push(that.a);\n hsla.toString = () => `hsla(${rhsla[0]}, ${rhsla[1]}%, ${rhsla[2]}%, ${that.a.toFixed(1)})`;\n return hsla;\n },\n\n toRGBA() {\n const rgba = Color.hsvToRgb(that.h, that.s, that.v);\n const rrgba = rgba.map(ceil);\n\n rgba.push(that.a);\n rgba.toString = () => `rgba(${rrgba[0]}, ${rrgba[1]}, ${rrgba[2]}, ${that.a.toFixed(1)})`;\n return rgba;\n },\n\n toCMYK() {\n const cmyk = Color.hsvToCmyk(that.h, that.s, that.v);\n const rcmyk = cmyk.map(ceil);\n\n cmyk.toString = () => `cmyk(${rcmyk[0]}%, ${rcmyk[1]}%, ${rcmyk[2]}%, ${rcmyk[3]}%)`;\n return cmyk;\n },\n\n toHEXA() {\n const hex = Color.hsvToHex(...[that.h, that.s, that.v]);\n\n hex.toString = () => {\n\n // Check if alpha channel make sense, convert it to 255 number space, convert\n // to hex and pad it with zeros if needet.\n const alpha = that.a >= 1 ? '' : padStart(Number((that.a * 255).toFixed(0))\n .toString(16)\n .toUpperCase(), 2, '0');\n\n return `#${hex.join('').toUpperCase() + alpha}`;\n };\n\n return hex;\n },\n\n clone() {\n return HSVaColor(that.h, that.s, that.v, that.a);\n }\n };\n\n // TODO: Remove in 0.5.0\n that.toHEX = that.toHEXA;\n return that;\n}\n","import * as _ from './../lib/utils';\r\n\r\nexport default function Moveable(opt) {\r\n\r\n const that = {\r\n\r\n // Assign default values\r\n options: Object.assign({\r\n lockX: false,\r\n lockY: false,\r\n onchange: () => 0\r\n }, opt),\r\n\r\n _tapstart(evt) {\r\n _.on(document, ['mouseup', 'touchend', 'touchcancel'], that._tapstop);\r\n _.on(document, ['mousemove', 'touchmove'], that._tapmove);\r\n\r\n // Prevent default touch event\r\n evt.preventDefault();\r\n\r\n // Trigger\r\n that._tapmove(evt);\r\n },\r\n\r\n _tapmove(evt) {\r\n const {options, cache} = that;\r\n const {element} = options;\r\n const b = that.options.wrapper.getBoundingClientRect();\r\n\r\n let x = 0, y = 0;\r\n if (evt) {\r\n const touch = evt && evt.touches && evt.touches[0];\r\n x = evt ? (touch || evt).clientX : 0;\r\n y = evt ? (touch || evt).clientY : 0;\r\n\r\n // Reset to bounds\r\n if (x < b.left) x = b.left;\r\n else if (x > b.left + b.width) x = b.left + b.width;\r\n if (y < b.top) y = b.top;\r\n else if (y > b.top + b.height) y = b.top + b.height;\r\n\r\n // Normalize\r\n x -= b.left;\r\n y -= b.top;\r\n } else if (cache) {\r\n x = cache.x * b.width;\r\n y = cache.y * b.height;\r\n }\r\n\r\n if (!options.lockX) {\r\n element.style.left = `calc(${x / b.width * 100}% - ${element.offsetWidth / 2}px)`;\r\n }\r\n\r\n if (!options.lockY) {\r\n element.style.top = `calc(${y / b.height * 100}% - ${element.offsetWidth / 2}px)`;\r\n }\r\n\r\n that.cache = {x: x / b.width, y: y / b.height};\r\n options.onchange(x, y);\r\n },\r\n\r\n _tapstop() {\r\n _.off(document, ['mouseup', 'touchend', 'touchcancel'], that._tapstop);\r\n _.off(document, ['mousemove', 'touchmove'], that._tapmove);\r\n },\r\n\r\n trigger() {\r\n that._tapmove();\r\n },\r\n\r\n update(x = 0, y = 0) {\r\n const wrapperRect = that.options.wrapper.getBoundingClientRect();\r\n that._tapmove({\r\n clientX: wrapperRect.left + x,\r\n clientY: wrapperRect.top + y\r\n });\r\n },\r\n\r\n destroy() {\r\n const {options, _tapstart} = that;\r\n _.off([options.wrapper, options.element], 'mousedown', _tapstart);\r\n _.off([options.wrapper, options.element], 'touchstart', _tapstart, {\r\n passive: false\r\n });\r\n }\r\n };\r\n\r\n // Initilize\r\n const {options, _tapstart} = that;\r\n _.on([options.wrapper, options.element], 'mousedown', _tapstart);\r\n _.on([options.wrapper, options.element], 'touchstart', _tapstart, {\r\n passive: false\r\n });\r\n\r\n return that;\r\n}\r\n","import * as _ from './../lib/utils';\r\n\r\nexport default function Selectable(opt = {}) {\r\n opt = Object.assign({\r\n onchange: () => 0,\r\n className: '',\r\n elements: []\r\n }, opt);\r\n\r\n const onTap = _.on(opt.elements, 'click', evt => {\r\n opt.elements.forEach(e =>\r\n e.classList[evt.target === e ? 'add' : 'remove'](opt.className)\r\n );\r\n\r\n opt.onchange(evt);\r\n });\r\n\r\n return {\r\n destroy: () => _.off(...onTap)\r\n };\r\n}\r\n","// Import styles\nimport '../scss/pickr.scss';\n\n// Import utils\nimport * as _ from './lib/utils';\nimport * as Color from './lib/color';\n\n// Import classes\nimport {HSVaColor} from './lib/hsvacolor';\nimport Moveable from './helper/moveable';\nimport Selectable from './helper/selectable';\n\nclass Pickr {\n\n // Will be used to prevent specific actions during initilization\n _initializingActive = true;\n\n // Replace element with color picker\n _recalc = true;\n\n // Current and last color for comparison\n _color = HSVaColor();\n _lastColor = HSVaColor();\n _swatchColors = [];\n\n // Evenlistener name: [callbacks]\n _eventListener = {\n 'swatchselect': [],\n 'change': [],\n 'save': [],\n 'init': []\n };\n\n constructor(opt) {\n\n // Assign default values\n this.options = opt = Object.assign({\n useAsButton: false,\n disabled: false,\n comparison: true,\n\n components: {\n interaction: {}\n },\n strings: {},\n\n swatches: null,\n inline: false,\n\n default: 'fff',\n defaultRepresentation: null,\n position: 'middle',\n adjustableNumbers: true,\n showAlways: false,\n\n closeWithKey: 'Escape'\n }, opt);\n const {swatches, inline, components} = opt;\n\n // Check interaction section\n if (!components.interaction) {\n components.interaction = {};\n }\n\n // Overwrite palette if preview, opacity or hue are true\n const {preview, opacity, hue, palette} = components;\n components.palette = palette || preview || opacity || hue;\n\n // Per default enabled if inline\n if (inline) {\n opt.showAlways = true;\n }\n\n // Initialize picker\n this._preBuild();\n this._buildComponents();\n this._bindEvents();\n\n // Finalize build\n this._finalBuild();\n\n // Append pre-defined swatch colors\n if (swatches && swatches.length) {\n swatches.forEach(color => this.addSwatch(color));\n }\n\n // Initilization is finish, pickr is visible and ready for usage\n const {button} = this._root;\n requestAnimationFrame((function cb() {\n\n // offsetParent of body is always 0. So check if it is the body\n if (button.offsetParent === null && button !== document.body) {\n return requestAnimationFrame(cb.bind(this));\n }\n\n // Apply default color\n this.setColor(opt.default);\n this._rePositioningPicker();\n\n // Initialize color representation\n if (opt.defaultRepresentation) {\n this._representation = opt.defaultRepresentation;\n this.setColorRepresentation(this._representation);\n }\n\n // Show pickr if locked\n if (opt.showAlways) {\n this.show();\n }\n\n // Initialization is done - pickr is usable, fire init event\n this._initializingActive = false;\n this._emit('init');\n }).bind(this));\n }\n\n // Does only the absolutly basic thing to initialize the components\n _preBuild() {\n const opt = this.options;\n\n // Check if element is selector\n if (typeof opt.el === 'string') {\n\n // Resolve possible shadow dom access\n opt.el = opt.el.split(/>>/g).reduce((pv, cv, ci, a) => {\n pv = pv.querySelector(cv);\n return ci < a.length - 1 ? pv.shadowRoot : pv;\n }, document);\n }\n\n // Create element and append it to body to\n // prevent initialization errors\n this._root = create(opt);\n\n // Check if a custom button is used\n if (opt.useAsButton) {\n this._root.button = opt.el; // Replace button with customized button\n }\n\n document.body.appendChild(this._root.root);\n }\n\n _finalBuild() {\n const opt = this.options;\n const root = this._root;\n\n // Remove from body\n document.body.removeChild(root.root);\n\n if (opt.inline) {\n const {parentElement} = opt.el;\n\n if (parentElement.lastChild === opt.el) {\n parentElement.appendChild(root.app);\n } else {\n parentElement.insertBefore(root.app, opt.el.nextSibling);\n }\n } else {\n document.body.appendChild(root.app);\n }\n\n // Don't replace the the element if a custom button is used\n if (!opt.useAsButton) {\n\n // Replace element with actual color-picker\n opt.el.parentNode.replaceChild(root.root, opt.el);\n }\n\n // Call disable to also add the disabled class\n if (opt.disabled) {\n this.disable();\n }\n\n // Check if color comparison is disabled, if yes - remove transitions so everything keeps smoothly\n if (!opt.comparison) {\n root.button.style.transition = 'none';\n if (!opt.useAsButton) {\n root.preview.lastColor.style.transition = 'none';\n }\n }\n\n this.hide();\n }\n\n _buildComponents() {\n\n // Instance reference\n const inst = this;\n const comp = this.options.components;\n\n const components = {\n\n palette: Moveable({\n element: inst._root.palette.picker,\n wrapper: inst._root.palette.palette,\n\n onchange(x, y) {\n if (!comp.palette) return;\n const {_color, _root, options} = inst;\n\n // Calculate saturation based on the position\n _color.s = (x / this.wrapper.offsetWidth) * 100;\n\n // Calculate the value\n _color.v = 100 - (y / this.wrapper.offsetHeight) * 100;\n\n // Prevent falling under zero\n _color.v < 0 ? _color.v = 0 : 0;\n\n // Set picker and gradient color\n const cssRGBaString = _color.toRGBA().toString();\n this.element.style.background = cssRGBaString;\n this.wrapper.style.background = `\n linear-gradient(to top, rgba(0, 0, 0, ${_color.a}), transparent), \n linear-gradient(to left, hsla(${_color.h}, 100%, 50%, ${_color.a}), rgba(255, 255, 255, ${_color.a}))\n `;\n\n // Check if color is locked\n if (!options.comparison) {\n _root.button.style.color = cssRGBaString;\n\n if (!options.useAsButton) {\n _root.preview.lastColor.style.color = cssRGBaString;\n }\n }\n\n // Change current color\n _root.preview.currentColor.style.color = cssRGBaString;\n\n // Update the input field only if the user is currently not typing\n if (inst._recalc) {\n inst._updateOutput();\n }\n\n // If the user changes the color, remove the cleared icon\n _root.button.classList.remove('clear');\n }\n }),\n\n hue: Moveable({\n lockX: true,\n element: inst._root.hue.picker,\n wrapper: inst._root.hue.slider,\n\n onchange(x, y) {\n if (!comp.hue || !comp.palette) return;\n\n // Calculate hue\n inst._color.h = (y / this.wrapper.offsetHeight) * 360;\n\n // Update color\n this.element.style.backgroundColor = `hsl(${inst._color.h}, 100%, 50%)`;\n components.palette.trigger();\n }\n }),\n\n opacity: Moveable({\n lockX: true,\n element: inst._root.opacity.picker,\n wrapper: inst._root.opacity.slider,\n\n onchange(x, y) {\n if (!comp.opacity || !comp.palette) return;\n\n // Calculate opacity\n inst._color.a = Math.round(((y / this.wrapper.offsetHeight)) * 1e2) / 100;\n\n // Update color\n this.element.style.background = `rgba(0, 0, 0, ${inst._color.a})`;\n inst.components.palette.trigger();\n }\n }),\n\n selectable: Selectable({\n elements: inst._root.interaction.options,\n className: 'active',\n onchange(e) {\n inst._representation = e.target.getAttribute('data-type').toUpperCase();\n inst._updateOutput();\n }\n })\n };\n\n this.components = components;\n }\n\n _bindEvents() {\n const {_root, options} = this;\n\n const eventBindings = [\n\n // Clear color\n _.on(_root.interaction.clear, 'click', () => this._clearColor()),\n\n // Select last color on click\n _.on(_root.preview.lastColor, 'click', () => this.setHSVA(...this._lastColor.toHSVA())),\n\n // Save color\n _.on(_root.interaction.save, 'click', () => {\n !this.applyColor() && !options.showAlways && this.hide();\n }),\n\n // Detect user input and disable auto-recalculation\n _.on(_root.interaction.result, ['keyup', 'input'], e => {\n this._recalc = false;\n\n // Fire listener if initialization is finish and changed color was valid\n if (this.setColor(e.target.value, true) && !this._initializingActive) {\n this._emit('change', this._color);\n }\n\n e.stopImmediatePropagation();\n }),\n\n // Cancel input detection on color change\n _.on([\n _root.palette.palette,\n _root.palette.picker,\n _root.hue.slider,\n _root.hue.picker,\n _root.opacity.slider,\n _root.opacity.picker\n ], ['mousedown', 'touchstart'], () => this._recalc = true)\n ];\n\n // Provide hiding / showing abilities only if showAlways is false\n if (!options.showAlways) {\n const ck = options.closeWithKey;\n\n eventBindings.push(\n // Save and hide / show picker\n _.on(_root.button, 'click', () => this.isOpen() ? this.hide() : this.show()),\n\n // Close with escape key\n _.on(document, 'keyup', e => this.isOpen() && (e.key === ck || e.code === ck) && this.hide()),\n\n // Cancel selecting if the user taps behind the color picker\n _.on(document, ['touchstart', 'mousedown'], e => {\n if (this.isOpen() && !_.eventPath(e).some(el => el === _root.app || el === _root.button)) {\n this.hide();\n }\n }, {capture: true})\n );\n }\n\n // Make input adjustable if enabled\n if (options.adjustableNumbers) {\n _.adjustableInputNumbers(_root.interaction.result, false);\n }\n\n if (!options.inline) {\n let updateTimeout;\n\n // Re-calc position on window resize, scroll and wheel\n eventBindings.push(_.on(window, ['scroll', 'wheel', 'resize'], () => {\n if (this.isOpen()) {\n this.hide();\n\n if (updateTimeout) {\n clearTimeout(updateTimeout);\n }\n\n updateTimeout = setTimeout(() => this.show(), 250);\n }\n }));\n }\n\n // Save bindings\n this._eventBindings = eventBindings;\n }\n\n _rePositioningPicker = (() => {\n const padding = 8;\n let left, top;\n\n return () => {\n\n // No repositioning needed if inline\n if (this.options.inline) {\n return;\n }\n\n const {app, button} = this._root;\n const {innerWidth, innerHeight} = window;\n const bb = button.getBoundingClientRect();\n const ab = app.getBoundingClientRect();\n\n // Check if picker is cuttet of from the top & bottom\n if (innerHeight - (bb.bottom + ab.height + padding) < 0) {\n top = bb.top - ab.height - padding;\n } else {\n top = bb.bottom + padding;\n }\n\n // Positioning picker on the x-axis\n const pos = {\n left: bb.left + bb.width - ab.width,\n middle: (-ab.width / 2) + (bb.left + bb.width / 2),\n right: bb.left\n };\n\n const wantedLeft = pos[this.options.position];\n if (left + wantedLeft > innerWidth) {\n left = pos['left'];\n } else if (wantedLeft < 0) {\n left = pos['right'];\n } else {\n left = wantedLeft;\n }\n\n Object.assign(app.style, {\n left: `${left}px`,\n top: `${top}px`\n });\n };\n })();\n\n _updateOutput() {\n\n // Check if component is present\n if (this._root.interaction.type()) {\n\n // Construct function name and call if present\n const method = `to${this._root.interaction.type().getAttribute('data-type')}`;\n this._root.interaction.result.value = typeof this._color[method] === 'function' ? this._color[method]().toString() : '';\n }\n\n // Fire listener if initialization is finish\n if (!this._initializingActive) {\n this._emit('change', this._color);\n }\n }\n\n _clearColor() {\n const {_root, options} = this;\n\n // Change only the button color if it isn't customized\n if (!options.useAsButton) {\n _root.button.style.color = 'rgba(0, 0, 0, 0.15)';\n }\n\n _root.button.classList.add('clear');\n\n if (!options.showAlways) {\n this.hide();\n }\n\n if (!this._initializingActive) {\n\n // Fire listener\n this._emit('save', null);\n }\n }\n\n _emit(event, ...args) {\n this._eventListener[event].forEach(cb => cb(...args, this));\n }\n\n on(event, cb) {\n\n // Validate\n if (typeof cb === 'function' && typeof event === 'string' && event in this._eventListener) {\n this._eventListener[event].push(cb);\n }\n\n return this;\n }\n\n off(event, cb) {\n const callBacks = this._eventListener[event];\n\n if (callBacks) {\n const index = callBacks.indexOf(cb);\n\n if (~index) {\n callBacks.splice(index, 1);\n }\n }\n\n return this;\n }\n\n /**\n * Appends a color to the swatch palette\n * @param color\n * @returns {boolean}\n */\n addSwatch(color) {\n const {values} = Color.parseToHSV(color);\n\n if (values) {\n const {_swatchColors, _root} = this;\n const hsvaColorObject = HSVaColor(...values);\n\n // Create new swatch HTMLElement\n const element = _.createElementFromString(\n ``\n );\n\n // Append element and save swatch data\n _root.swatches.appendChild(element);\n _swatchColors.push({element, hsvaColorObject});\n\n // Bind event\n this._eventBindings.push(\n _.on(element, 'click', () => {\n this.setHSVA(...hsvaColorObject.toHSVA(), true);\n this._emit('swatchselect', hsvaColorObject);\n })\n );\n\n return true;\n }\n\n return false;\n }\n\n /**\n * Removes a swatch color by it's index\n * @param index\n * @returns {boolean}\n */\n removeSwatch(index) {\n\n // Validate index\n if (typeof index === 'number') {\n const swatchColor = this._swatchColors[index];\n\n // Check swatch data\n if (swatchColor) {\n const {element} = swatchColor;\n\n // Remove HTML child and swatch data\n this._root.swatches.removeChild(element);\n this._swatchColors.splice(index, 1);\n return true;\n }\n }\n\n return false;\n }\n\n applyColor(silent = false) {\n const {preview, button} = this._root;\n\n // Change preview and current color\n const cssRGBaString = this._color.toRGBA().toString();\n preview.lastColor.style.color = cssRGBaString;\n\n // Change only the button color if it isn't customized\n if (!this.options.useAsButton) {\n button.style.color = cssRGBaString;\n }\n\n // User changed the color so remove the clear clas\n button.classList.remove('clear');\n\n // Save last color\n this._lastColor = this._color.clone();\n\n // Fire listener\n if (!this._initializingActive && !silent) {\n this._emit('save', this._color);\n }\n }\n\n /**\n * Destroy's all functionalitys\n */\n destroy() {\n this._eventBindings.forEach(args => _.off(...args));\n Object.keys(this.components).forEach(key => this.components[key].destroy());\n }\n\n /**\n * Destroy's all functionalitys and removes\n * the pickr element.\n */\n destroyAndRemove() {\n this.destroy();\n\n // Remove element\n const root = this._root.root;\n root.parentElement.removeChild(root);\n\n // remove .pcr-app\n const app = this._root.app;\n app.parentElement.removeChild(app);\n\n // There are references to various DOM elements stored in the pickr instance\n // This cleans all of them to avoid detached DOMs\n const pickr = this;\n Object.keys(pickr).forEach(key => pickr[key] = null);\n }\n\n /**\n * Hides the color-picker ui.\n */\n hide() {\n this._root.app.classList.remove('visible');\n return this;\n }\n\n /**\n * Shows the color-picker ui.\n */\n show() {\n if (this.options.disabled) return;\n this._root.app.classList.add('visible');\n this._rePositioningPicker();\n return this;\n }\n\n /**\n * @return {boolean} If the color picker is currently open\n */\n isOpen() {\n return this._root.app.classList.contains('visible');\n }\n\n /**\n * Set a specific color.\n * @param h Hue\n * @param s Saturation\n * @param v Value\n * @param a Alpha channel (0 - 1)\n * @param silent If the button should not change the color\n * @return boolean if the color has been accepted\n */\n setHSVA(h = 360, s = 0, v = 0, a = 1, silent = false) {\n\n // Deactivate color calculation\n const recalc = this._recalc; // Save state\n this._recalc = false;\n\n // Validate input\n if (h < 0 || h > 360 || s < 0 || s > 100 || v < 0 || v > 100 || a < 0 || a > 1) {\n return false;\n }\n\n // Short names\n const {hue, opacity, palette} = this.components;\n\n // Calculate y position of hue slider\n const hueWrapper = hue.options.wrapper;\n const hueY = hueWrapper.offsetHeight * (h / 360);\n hue.update(0, hueY);\n\n // Calculate y position of opacity slider\n const opacityWrapper = opacity.options.wrapper;\n const opacityY = opacityWrapper.offsetHeight * a;\n opacity.update(0, opacityY);\n\n // Calculate y and x position of color palette\n const pickerWrapper = palette.options.wrapper;\n const pickerX = pickerWrapper.offsetWidth * (s / 100);\n const pickerY = pickerWrapper.offsetHeight * (1 - (v / 100));\n palette.update(pickerX, pickerY);\n\n // Override current color and re-active color calculation\n this._color = HSVaColor(h, s, v, a);\n this._recalc = recalc; // Restore old state\n\n // Update output if recalculation is enabled\n if (this._recalc) {\n this._updateOutput();\n }\n\n // Check if call is silent\n if (!silent) {\n this.applyColor();\n }\n\n return true;\n }\n\n /**\n * Tries to parse a string which represents a color.\n * Examples: #fff\n * rgb 10 10 200\n * hsva 10 20 5 0.5\n * @param string\n * @param silent\n */\n setColor(string, silent = false) {\n\n // Check if null\n if (string === null) {\n this._clearColor();\n return true;\n }\n\n const {values, type} = Color.parseToHSV(string);\n\n // Check if color is ok\n if (values) {\n\n // Change selected color format\n const utype = type.toUpperCase();\n const {options} = this._root.interaction;\n const target = options.find(el => el.getAttribute('data-type').startsWith(utype));\n\n // Auto select only if not hidden\n if (target && !target.hidden) {\n for (const el of options) {\n el.classList[el === target ? 'add' : 'remove']('active');\n }\n }\n\n return this.setHSVA(...values, silent);\n }\n }\n\n /**\n * Changes the color _representation.\n * Allowed values are HEX, RGB, HSV, HSL and CMYK\n * @param type\n * @returns {boolean} if the selected type was valid.\n */\n setColorRepresentation(type) {\n\n // Force uppercase to allow a case-sensitiv comparison\n type = type.toUpperCase();\n\n // Find button with given type and trigger click event\n return !!this._root.interaction.options.find(v => v.getAttribute('data-type').startsWith(type) && !v.click());\n }\n\n /**\n * Returns the current color representaion. See setColorRepresentation\n * @returns {*}\n */\n getColorRepresentation() {\n return this._representation;\n }\n\n /**\n * @returns HSVaColor Current HSVaColor object.\n */\n getColor() {\n return this._color;\n }\n\n /**\n * @returns The root HTMLElement with all his components.\n */\n getRoot() {\n return this._root;\n }\n\n /**\n * Disable pickr\n */\n disable() {\n this.hide();\n this.options.disabled = true;\n this._root.button.classList.add('disabled');\n return this;\n }\n\n /**\n * Enable pickr\n */\n enable() {\n this.options.disabled = false;\n this._root.button.classList.remove('disabled');\n return this;\n }\n}\n\nfunction create(options) {\n const {components, strings, useAsButton, inline} = options;\n const hidden = con => con ? '' : 'style=\"display:none\" hidden';\n\n const root = _.createFromTemplate(`\n
\n \n ${useAsButton ? '' : ''}\n\n
\n
\n
\n \n
\n
\n\n
\n
\n
\n
\n\n
\n
\n
\n
\n\n
\n
\n
\n
\n
\n\n
\n\n
\n \n\n \n \n \n \n \n\n \n \n
\n
\n
\n `);\n\n const int = root.interaction;\n\n // Select option which is not hidden\n int.options.find(o => !o.hidden && !o.classList.add('active'));\n\n // Create method to find currenlty active option\n int.type = () => int.options.find(e => e.classList.contains('active'));\n return root;\n}\n\n// Static methods\nPickr.utils = {\n once: _.once,\n on: _.on,\n off: _.off,\n eventPath: _.eventPath,\n createElementFromString: _.createElementFromString,\n adjustableInputNumbers: _.adjustableInputNumbers,\n removeAttribute: _.removeAttribute,\n createFromTemplate: _.createFromTemplate\n};\n\n// Create instance via method\nPickr.create = (options) => new Pickr(options);\n\n// Export\nPickr.version = '0.4.11';\nexport default Pickr;\n"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap","webpack:///./src/js/lib/utils.js","webpack:///./src/js/lib/color.js","webpack:///./src/js/lib/hsvacolor.js","webpack:///./src/js/helper/moveable.js","webpack:///./src/js/helper/selectable.js","webpack:///./src/js/pickr.js"],"names":["root","factory","exports","module","define","amd","window","installedModules","__webpack_require__","moduleId","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","on","eventListener","off","method","elements","events","fn","options","arguments","length","undefined","HTMLCollection","NodeList","Array","from","isArray","forEach","el","ev","_objectSpread","capture","slice","createElementFromString","html","div","document","createElement","innerHTML","trim","firstElementChild","removeAttribute","getAttribute","createFromTemplate","str","resolve","element","base","con","children","subtree","child","arr","push","eventPath","evt","path","composedPath","target","parentElement","adjustableInputNumbers","negative","isNumChar","handleScroll","e","val","selectionStart","numStart","num","isNaN","isFinite","mul","deltaY","inc","ctrlKey","newNum","Number","newStr","substr","substring","curPos","String","focus","setSelectionRange","preventDefault","dispatchEvent","Event","passive","padStart","string","maxLength","fillString","repeat","min","Math","max","floor","round","hsvToRgb","h","v","f","q","mod","rgbToHsv","g","b","minVal","maxVal","delta","dr","dg","db","cmykToHsv","y","k","hslToHsv","hexToHsv","hex","match","map","parseInt","parseToHSV","ctx","getContext","fillStyle","standardizeColor","regex","cmyk","rgba","hsla","hsva","numarize","array","test","type","exec","_numarize2","_slicedToArray","values","_numarize4","_numarize4$","a","splitAt","alpha","_splitAt$map2","_splitAt2","_numarize6","_numarize6$","_numarize8","_numarize8$","HSVaColor","ceil","that","toHSVA","rhsva","toString","concat","toFixed","toHSLA","Color","rhsla","toRGBA","rrgba","toCMYK","rgb","rcmyk","toHEXA","toUpperCase","join","clone","toHEX","Moveable","opt","assign","lockX","lockY","onchange","_tapstart","_","_tapstop","_tapmove","cache","wrapper","getBoundingClientRect","x","touch","touches","clientX","clientY","left","width","top","height","style","offsetWidth","trigger","update","wrapperRect","destroy","Selectable","className","onTap","classList","Pickr","constructor","pickr_defineProperty","this","swatchselect","change","save","init","inline","_this$_root","_root","app","button","_window","innerWidth","innerHeight","bb","ab","bottom","pos","middle","right","wantedLeft","position","useAsButton","disabled","comparison","components","interaction","strings","swatches","default","defaultRepresentation","adjustableNumbers","showAlways","closeWithKey","_opt","preview","opacity","hue","palette","_preBuild","_buildComponents","_bindEvents","_finalBuild","color","addSwatch","requestAnimationFrame","cb","offsetParent","body","setColor","_rePositioningPicker","_representation","setColorRepresentation","show","_initializingActive","_emit","split","reduce","pv","cv","ci","querySelector","shadowRoot","hidden","keys","input","clear","int","find","add","contains","appendChild","removeChild","lastChild","insertBefore","nextSibling","parentNode","replaceChild","disable","transition","lastColor","hide","inst","comp","picker","_color","offsetHeight","cssRGBaString","background","currentColor","_recalc","_updateOutput","remove","slider","backgroundColor","selectable","eventBindings","_clearColor","setHSVA","_lastColor","applyColor","result","stopImmediatePropagation","ck","isOpen","code","some","updateTimeout","clearTimeout","setTimeout","_eventBindings","event","_len","args","_key","_eventListener","callBacks","index","indexOf","splice","_swatchColors","hsvaColorObject","removeSwatch","swatchColor","silent","_this$_root2","destroyAndRemove","pickr","recalc","_this$components","hueY","opacityY","pickerWrapper","pickerX","pickerY","_Color$parseToHSV2","utype","startsWith","click","getColorRepresentation","getColor","getRoot","enable","utils","once","helper","apply","removeEventListener","version"],"mappings":";CAAA,SAAAA,EAAAC,GACA,iBAAAC,SAAA,iBAAAC,OACAA,OAAAD,QAAAD,IACA,mBAAAG,eAAAC,IACAD,OAAA,GAAAH,GACA,iBAAAC,QACAA,QAAA,MAAAD,IAEAD,EAAA,MAAAC,IARA,CASCK,OAAA,WACD,mBCTA,IAAAC,EAAA,GAGA,SAAAC,EAAAC,GAGA,GAAAF,EAAAE,GACA,OAAAF,EAAAE,GAAAP,QAGA,IAAAC,EAAAI,EAAAE,GAAA,CACAC,EAAAD,EACAE,GAAA,EACAT,QAAA,IAUA,OANAU,EAAAH,GAAAI,KAAAV,EAAAD,QAAAC,IAAAD,QAAAM,GAGAL,EAAAQ,GAAA,EAGAR,EAAAD,QA0DA,OArDAM,EAAAM,EAAAF,EAGAJ,EAAAO,EAAAR,EAGA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c,aAAa,aAAa6S,WAAWD,IAG1E,GAAI5R,IAAWA,EAAOmN,OAClB,IAAK,MAAMjP,KAAMV,EACbU,EAAG+K,UAAU/K,IAAO8B,EAAS,MAAQ,UAAU,UAIvD,OAAOqJ,KAAKiG,WAAWrK,EAAQ+L,IAUvCxE,uBAAuB3H,GAMnB,OAHAA,EAAOA,EAAKiC,gBAGHuC,KAAKO,MAAMkB,YAAYtN,QAAQgQ,KAAK9K,GAAKA,EAAE1D,aAAa,aAAa6S,WAAWhN,KAAUnC,EAAEoP,SAOzGC,yBACI,OAAO1I,KAAKkD,gBAMhByF,WACI,OAAO3I,KAAKoF,OAMhBwD,UACI,OAAO5I,KAAKO,MAMhBsE,UAII,OAHA7E,KAAKgF,OACLhF,KAAK7L,QAAQmN,UAAW,EACxBtB,KAAKO,MAAME,OAAOb,UAAUwE,IAAI,YACzBpE,KAMX6I,SAGI,OAFA7I,KAAK7L,QAAQmN,UAAW,EACxBtB,KAAKO,MAAME,OAAOb,UAAU+F,OAAO,YAC5B3F,MAiEfH,EAAMiJ,MAAQ,CACVC,KLvzBgB,CAAChT,EAAS+Q,EAAO5S,EAAIC,IAAYP,EAAGmC,EAAS+Q,EAAO,SAASkC,IAC7E9U,EAAG+U,MAAMjJ,KAAM5L,WACf4L,KAAKkJ,oBAAoBpC,EAAOkC,IACjC7U,GKqzBCP,GAAIwK,EACJtK,IAAKsK,EACL7H,UAAW6H,EACXlJ,wBAAyBkJ,EACzBvH,uBAAwBuH,EACxB1I,gBAAiB0I,EACjBxI,mBAAoBwI,GAIxByB,EAAM3M,OAAUiB,IAAY,IAAI0L,EAAM1L,IAGtC0L,EAAMsJ,QAAU,QACDtJ","file":"pickr.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"Pickr\"] = factory();\n\telse\n\t\troot[\"Pickr\"] = factory();\n})(window, function() {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 1);\n","/**\n * Add an eventlistener which will be fired only once.\n *\n * @param element Target element\n * @param event Event name\n * @param fn Callback\n * @param options Optional options\n * @return Array passed arguments\n */\nexport const once = (element, event, fn, options) => on(element, event, function helper() {\n fn.apply(this, arguments);\n this.removeEventListener(event, helper);\n}, options);\n\n/**\n * Add event(s) to element(s).\n * @param elements DOM-Elements\n * @param events Event names\n * @param fn Callback\n * @param options Optional options\n * @return Array passed arguments\n */\nexport const on = eventListener.bind(null, 'addEventListener');\n\n/**\n * Remove event(s) from element(s).\n * @param elements DOM-Elements\n * @param events Event names\n * @param fn Callback\n * @param options Optional options\n * @return Array passed arguments\n */\nexport const off = eventListener.bind(null, 'removeEventListener');\n\nfunction eventListener(method, elements, events, fn, options = {}) {\n\n // Normalize array\n if (elements instanceof HTMLCollection || elements instanceof NodeList) {\n elements = Array.from(elements);\n } else if (!Array.isArray(elements)) {\n elements = [elements];\n }\n\n if (!Array.isArray(events)) {\n events = [events];\n }\n\n elements.forEach(el =>\n events.forEach(ev =>\n el[method](ev, fn, {capture: false, ...options})\n )\n );\n\n return Array.prototype.slice.call(arguments, 1);\n}\n\n/**\n * Creates an DOM-Element out of a string (Single element).\n * @param html HTML representing a single element\n * @returns {Element | null} The element.\n */\nexport function createElementFromString(html) {\n const div = document.createElement('div');\n div.innerHTML = html.trim();\n return div.firstElementChild;\n}\n\n/**\n * Removes an attribute from a HTMLElement and returns the value.\n * @param el\n * @param name\n * @return {string}\n */\nexport function removeAttribute(el, name) {\n const value = el.getAttribute(name);\n el.removeAttribute(name);\n return value;\n}\n\n/**\n * Creates a new html element, every element which has\n * a 'data-key' attribute will be saved in a object (which will be returned)\n * where the value of 'data-key' ist the object-key and the value the HTMLElement.\n *\n * It's possible to create a hierarchy if you add a 'data-con' attribute. Every\n * sibling will be added to the object which will get the name from the 'data-con' attribute.\n *\n * If you want to create an Array out of multiple elements, you can use the 'data-arr' attribute,\n * the value defines the key and all elements, which has the same parent and the same 'data-arr' attribute,\n * would be added to it.\n *\n * @param str - The HTML String.\n */\nexport function createFromTemplate(str) {\n\n // Recursive function to resolve template\n function resolve(element, base = {}) {\n\n // Check key and container attribute\n const con = removeAttribute(element, 'data-con');\n const key = removeAttribute(element, 'data-key');\n\n // Check and save element\n if (key) {\n base[key] = element;\n }\n\n // Check all children\n const children = Array.from(element.children);\n const subtree = con ? (base[con] = {}) : base;\n for (let child of children) {\n\n // Check if element should be saved as array\n const arr = removeAttribute(child, 'data-arr');\n if (arr) {\n\n // Check if there is already an array and add element\n (subtree[arr] || (subtree[arr] = [])).push(child);\n } else {\n resolve(child, subtree);\n }\n }\n\n return base;\n }\n\n return resolve(createElementFromString(str));\n}\n\n/**\n * Polyfill for safari & firefox for the eventPath event property.\n * @param evt The event object.\n * @return [String] event path.\n */\nexport function eventPath(evt) {\n let path = evt.path || (evt.composedPath && evt.composedPath());\n if (path) return path;\n\n let el = evt.target.parentElement;\n path = [evt.target, el];\n while (el = el.parentElement) path.push(el);\n\n path.push(document, window);\n return path;\n}\n\n/**\n * Creates the ability to change numbers in an input field with the scroll-wheel.\n * @param el\n * @param negative\n */\nexport function adjustableInputNumbers(el, negative = true) {\n\n // Check if a char represents a number\n const isNumChar = c => (c >= '0' && c <= '9') || c === '-' || c === '.';\n\n function handleScroll(e) {\n const val = el.value;\n const off = el.selectionStart;\n let numStart = off;\n let num = ''; // Will be the number as string\n\n // Look back\n for (let i = off - 1; i > 0 && isNumChar(val[i]); i--) {\n num = val[i] + num;\n numStart--; // Find start of number\n }\n\n // Look forward\n for (let i = off, n = val.length; i < n && isNumChar(val[i]); i++) {\n num += val[i];\n }\n\n // Check if number is valid\n if (num.length > 0 && !isNaN(num) && isFinite(num)) {\n\n const mul = e.deltaY < 0 ? 1 : -1;\n const inc = e.ctrlKey ? mul * 5 : mul;\n let newNum = Number(num) + inc;\n\n if (!negative && newNum < 0) {\n newNum = 0;\n }\n\n const newStr = val.substr(0, numStart) + newNum + val.substring(numStart + num.length, val.length);\n const curPos = numStart + String(newNum).length;\n\n // Update value and set cursor\n el.value = newStr;\n el.focus();\n el.setSelectionRange(curPos, curPos);\n }\n\n // Prevent default\n e.preventDefault();\n\n // Trigger input event\n el.dispatchEvent(new Event('input'));\n }\n\n // Bind events\n on(el, 'focus', () => on(window, 'wheel', handleScroll, {passive: false}));\n on(el, 'blur', () => off(window, 'wheel', handleScroll));\n}\n\n/**\n * Cross browser padStart implementation\n * @param string\n * @param maxLength\n * @param fillString\n * @returns {string}\n */\nexport function padStart(string, maxLength, fillString = ' ') {\n maxLength = maxLength - string.length;\n\n if (maxLength <= 0 || !fillString.length) {\n return String(string);\n } else {\n\n if (maxLength > fillString.length) {\n fillString += fillString.repeat(maxLength / fillString.length);\n }\n\n return fillString.slice(0, maxLength) + String(string);\n }\n}\n","import {padStart} from '../lib/utils';\n\n// Shorthands\nconst {min, max, floor, round} = Math;\n\n/**\n * Tries to convert a color name to rgb/a hex representation\n * @param name\n * @returns {string | CanvasGradient | CanvasPattern}\n */\nfunction standardizeColor(name) {\n const ctx = document.createElement('canvas').getContext('2d');\n ctx.fillStyle = name;\n return ctx.fillStyle;\n}\n\n/**\n * Convert HSV spectrum to RGB.\n * @param h Hue\n * @param s Saturation\n * @param v Value\n * @returns {number[]} Array with rgb values.\n */\nexport function hsvToRgb(h, s, v) {\n h = (h / 360) * 6;\n s /= 100;\n v /= 100;\n\n let i = floor(h);\n\n let f = h - i;\n let p = v * (1 - s);\n let q = v * (1 - f * s);\n let t = v * (1 - (1 - f) * s);\n\n let mod = i % 6;\n let r = [v, q, p, p, t, v][mod];\n let g = [t, v, v, q, p, p][mod];\n let b = [p, p, t, v, v, q][mod];\n\n return [\n r * 255,\n g * 255,\n b * 255\n ];\n}\n\n/**\n * Convert HSV spectrum to Hex.\n * @param h Hue\n * @param s Saturation\n * @param v Value\n * @returns {string[]} Hex values\n */\nexport function hsvToHex(h, s, v) {\n return hsvToRgb(h, s, v).map(v =>\n padStart(round(v).toString(16), 2, '0')\n );\n}\n\n/**\n * Convert HSV spectrum to CMYK.\n * @param h Hue\n * @param s Saturation\n * @param v Value\n * @returns {number[]} CMYK values\n */\nexport function hsvToCmyk(h, s, v) {\n const rgb = hsvToRgb(h, s, v);\n const r = rgb[0] / 255;\n const g = rgb[1] / 255;\n const b = rgb[2] / 255;\n\n let k, c, m, y;\n\n k = min(1 - r, 1 - g, 1 - b);\n\n c = k === 1 ? 0 : (1 - r - k) / (1 - k);\n m = k === 1 ? 0 : (1 - g - k) / (1 - k);\n y = k === 1 ? 0 : (1 - b - k) / (1 - k);\n\n return [\n c * 100,\n m * 100,\n y * 100,\n k * 100\n ];\n}\n\n/**\n * Convert HSV spectrum to HSL.\n * @param h Hue\n * @param s Saturation\n * @param v Value\n * @returns {number[]} HSL values\n */\nexport function hsvToHsl(h, s, v) {\n s /= 100, v /= 100;\n\n let l = (2 - s) * v / 2;\n\n if (l !== 0) {\n if (l === 1) {\n s = 0;\n } else if (l < 0.5) {\n s = s * v / (l * 2);\n } else {\n s = s * v / (2 - l * 2);\n }\n }\n\n return [\n h,\n s * 100,\n l * 100\n ];\n}\n\n/**\n * Convert RGB to HSV.\n * @param r Red\n * @param g Green\n * @param b Blue\n * @return {number[]} HSV values.\n */\nfunction rgbToHsv(r, g, b) {\n r /= 255, g /= 255, b /= 255;\n\n let h, s, v;\n const minVal = min(r, g, b);\n const maxVal = max(r, g, b);\n const delta = maxVal - minVal;\n\n v = maxVal;\n if (delta === 0) {\n h = s = 0;\n } else {\n s = delta / maxVal;\n let dr = (((maxVal - r) / 6) + (delta / 2)) / delta;\n let dg = (((maxVal - g) / 6) + (delta / 2)) / delta;\n let db = (((maxVal - b) / 6) + (delta / 2)) / delta;\n\n if (r === maxVal) {\n h = db - dg;\n } else if (g === maxVal) {\n h = (1 / 3) + dr - db;\n } else if (b === maxVal) {\n h = (2 / 3) + dg - dr;\n }\n\n if (h < 0) {\n h += 1;\n } else if (h > 1) {\n h -= 1;\n }\n }\n\n return [\n h * 360,\n s * 100,\n v * 100\n ];\n}\n\n/**\n * Convert CMYK to HSV.\n * @param c Cyan\n * @param m Magenta\n * @param y Yellow\n * @param k Key (Black)\n * @return {number[]} HSV values.\n */\nfunction cmykToHsv(c, m, y, k) {\n c /= 100, m /= 100, y /= 100, k /= 100;\n\n const r = (1 - min(1, c * (1 - k) + k)) * 255;\n const g = (1 - min(1, m * (1 - k) + k)) * 255;\n const b = (1 - min(1, y * (1 - k) + k)) * 255;\n\n return [...rgbToHsv(r, g, b)];\n}\n\n/**\n * Convert HSL to HSV.\n * @param h Hue\n * @param s Saturation\n * @param l Lightness\n * @return {number[]} HSV values.\n */\nfunction hslToHsv(h, s, l) {\n s /= 100, l /= 100;\n s *= l < 0.5 ? l : 1 - l;\n\n let ns = (2 * s / (l + s)) * 100;\n let v = (l + s) * 100;\n return [h, ns, v];\n}\n\n/**\n * Convert HEX to HSV.\n * @param hex Hexadecimal string of rgb colors, can have length 3 or 6.\n * @return {number[]} HSV values.\n */\nfunction hexToHsv(hex) {\n return rgbToHsv(...hex.match(/.{2}/g).map(v => parseInt(v, 16)));\n}\n\n/**\n * Try's to parse a string which represents a color to a HSV array.\n * Current supported types are cmyk, rgba, hsla and hexadecimal.\n * @param str\n * @return {*}\n */\nexport function parseToHSV(str) {\n\n // Check if string is a color-name\n str = str.match(/^[a-zA-Z]+$/) ? standardizeColor(str) : str;\n\n // Regular expressions to match different types of color represention\n const regex = {\n cmyk: /^cmyk[\\D]+(\\d+)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]+(\\d+)/i,\n rgba: /^(rgb|rgba)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]*?([\\d.]+|$)/i,\n hsla: /^(hsl|hsla)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]*?([\\d.]+|$)/i,\n hsva: /^(hsv|hsva)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]*?([\\d.]+|$)/i,\n hex: /^#?(([\\dA-Fa-f]{3,4})|([\\dA-Fa-f]{6})|([\\dA-Fa-f]{8}))$/i\n };\n\n /**\n * Takes an Array of any type, convert strings which represents\n * a number to a number an anything else to undefined.\n * @param array\n * @return {*}\n */\n const numarize = array => array.map(v => /^(|\\d+)\\.\\d+|\\d+$/.test(v) ? Number(v) : undefined);\n\n let match;\n for (const type in regex) {\n\n // Check if current scheme passed\n if (!(match = regex[type].exec(str)))\n continue;\n\n // Try to convert\n switch (type) {\n case 'cmyk': {\n let [, c, m, y, k] = numarize(match);\n\n if (c > 100 || m > 100 || y > 100 || k > 100)\n break;\n\n return {values: [...cmykToHsv(c, m, y, k), 1], type};\n }\n case 'rgba': {\n let [, , r, g, b, a = 1] = numarize(match);\n\n if (r > 255 || g > 255 || b > 255 || a < 0 || a > 1)\n break;\n\n return {values: [...rgbToHsv(r, g, b), a], type};\n }\n case 'hex': {\n const splitAt = (s, i) => [s.substring(0, i), s.substring(i, s.length)];\n let [, hex] = match;\n\n // Fill up opacity if not declared\n if (hex.length === 3) {\n hex += 'F';\n } else if (hex.length === 6) {\n hex += 'FF';\n }\n\n let alpha;\n if (hex.length === 4) {\n [hex, alpha] = splitAt(hex, 3).map(v => v + v);\n } else if (hex.length === 8) {\n [hex, alpha] = splitAt(hex, 6);\n }\n\n // Convert 0 - 255 to 0 - 1 for opacity\n alpha = parseInt(alpha, 16) / 255;\n return {values: [...hexToHsv(hex), alpha], type};\n }\n case 'hsla': {\n let [, , h, s, l, a = 1] = numarize(match);\n\n if (h > 360 || s > 100 || l > 100 || a < 0 || a > 1)\n break;\n\n return {values: [...hslToHsv(h, s, l), a], type};\n }\n case 'hsva': {\n let [, , h, s, v, a = 1] = numarize(match);\n\n if (h > 360 || s > 100 || v > 100 || a < 0 || a > 1)\n break;\n\n return {values: [h, s, v, a], type};\n }\n }\n }\n\n return {values: null, type: null};\n}\n","import {padStart} from '../lib/utils';\nimport * as Color from './color';\n\n/**\n * Simple class which holds the properties\n * of the color represention model hsla (hue saturation lightness alpha)\n */\nexport function HSVaColor(h = 0, s = 0, v = 0, a = 1) {\n\n const ceil = Math.ceil;\n const that = {\n h, s, v, a,\n\n toHSVA() {\n const hsva = [that.h, that.s, that.v];\n const rhsva = hsva.map(ceil);\n\n hsva.push(that.a);\n hsva.toString = () => `hsva(${rhsva[0]}, ${rhsva[1]}%, ${rhsva[2]}%, ${that.a.toFixed(1)})`;\n return hsva;\n },\n\n toHSLA() {\n const hsla = Color.hsvToHsl(that.h, that.s, that.v);\n const rhsla = hsla.map(ceil);\n\n hsla.push(that.a);\n hsla.toString = () => `hsla(${rhsla[0]}, ${rhsla[1]}%, ${rhsla[2]}%, ${that.a.toFixed(1)})`;\n return hsla;\n },\n\n toRGBA() {\n const rgba = Color.hsvToRgb(that.h, that.s, that.v);\n const rrgba = rgba.map(ceil);\n\n rgba.push(that.a);\n rgba.toString = () => `rgba(${rrgba[0]}, ${rrgba[1]}, ${rrgba[2]}, ${that.a.toFixed(1)})`;\n return rgba;\n },\n\n toCMYK() {\n const cmyk = Color.hsvToCmyk(that.h, that.s, that.v);\n const rcmyk = cmyk.map(ceil);\n\n cmyk.toString = () => `cmyk(${rcmyk[0]}%, ${rcmyk[1]}%, ${rcmyk[2]}%, ${rcmyk[3]}%)`;\n return cmyk;\n },\n\n toHEXA() {\n const hex = Color.hsvToHex(...[that.h, that.s, that.v]);\n\n hex.toString = () => {\n\n // Check if alpha channel make sense, convert it to 255 number space, convert\n // to hex and pad it with zeros if needet.\n const alpha = that.a >= 1 ? '' : padStart(Number((that.a * 255).toFixed(0))\n .toString(16)\n .toUpperCase(), 2, '0');\n\n return `#${hex.join('').toUpperCase() + alpha}`;\n };\n\n return hex;\n },\n\n clone() {\n return HSVaColor(that.h, that.s, that.v, that.a);\n }\n };\n\n // TODO: Remove in 0.5.0\n that.toHEX = that.toHEXA;\n return that;\n}\n","import * as _ from './../lib/utils';\r\n\r\nexport default function Moveable(opt) {\r\n\r\n const that = {\r\n\r\n // Assign default values\r\n options: Object.assign({\r\n lockX: false,\r\n lockY: false,\r\n onchange: () => 0\r\n }, opt),\r\n\r\n _tapstart(evt) {\r\n _.on(document, ['mouseup', 'touchend', 'touchcancel'], that._tapstop);\r\n _.on(document, ['mousemove', 'touchmove'], that._tapmove);\r\n\r\n // Prevent default touch event\r\n evt.preventDefault();\r\n\r\n // Trigger\r\n that._tapmove(evt);\r\n },\r\n\r\n _tapmove(evt) {\r\n const {options, cache} = that;\r\n const {element} = options;\r\n const b = that.options.wrapper.getBoundingClientRect();\r\n\r\n let x = 0, y = 0;\r\n if (evt) {\r\n const touch = evt && evt.touches && evt.touches[0];\r\n x = evt ? (touch || evt).clientX : 0;\r\n y = evt ? (touch || evt).clientY : 0;\r\n\r\n // Reset to bounds\r\n if (x < b.left) x = b.left;\r\n else if (x > b.left + b.width) x = b.left + b.width;\r\n if (y < b.top) y = b.top;\r\n else if (y > b.top + b.height) y = b.top + b.height;\r\n\r\n // Normalize\r\n x -= b.left;\r\n y -= b.top;\r\n } else if (cache) {\r\n x = cache.x * b.width;\r\n y = cache.y * b.height;\r\n }\r\n\r\n if (!options.lockX) {\r\n element.style.left = `calc(${x / b.width * 100}% - ${element.offsetWidth / 2}px)`;\r\n }\r\n\r\n if (!options.lockY) {\r\n element.style.top = `calc(${y / b.height * 100}% - ${element.offsetWidth / 2}px)`;\r\n }\r\n\r\n that.cache = {x: x / b.width, y: y / b.height};\r\n options.onchange(x, y);\r\n },\r\n\r\n _tapstop() {\r\n _.off(document, ['mouseup', 'touchend', 'touchcancel'], that._tapstop);\r\n _.off(document, ['mousemove', 'touchmove'], that._tapmove);\r\n },\r\n\r\n trigger() {\r\n that._tapmove();\r\n },\r\n\r\n update(x = 0, y = 0) {\r\n const wrapperRect = that.options.wrapper.getBoundingClientRect();\r\n that._tapmove({\r\n clientX: wrapperRect.left + x,\r\n clientY: wrapperRect.top + y\r\n });\r\n },\r\n\r\n destroy() {\r\n const {options, _tapstart} = that;\r\n _.off([options.wrapper, options.element], 'mousedown', _tapstart);\r\n _.off([options.wrapper, options.element], 'touchstart', _tapstart, {\r\n passive: false\r\n });\r\n }\r\n };\r\n\r\n // Initilize\r\n const {options, _tapstart} = that;\r\n _.on([options.wrapper, options.element], 'mousedown', _tapstart);\r\n _.on([options.wrapper, options.element], 'touchstart', _tapstart, {\r\n passive: false\r\n });\r\n\r\n return that;\r\n}\r\n","import * as _ from './../lib/utils';\r\n\r\nexport default function Selectable(opt = {}) {\r\n opt = Object.assign({\r\n onchange: () => 0,\r\n className: '',\r\n elements: []\r\n }, opt);\r\n\r\n const onTap = _.on(opt.elements, 'click', evt => {\r\n opt.elements.forEach(e =>\r\n e.classList[evt.target === e ? 'add' : 'remove'](opt.className)\r\n );\r\n\r\n opt.onchange(evt);\r\n });\r\n\r\n return {\r\n destroy: () => _.off(...onTap)\r\n };\r\n}\r\n","// Import styles\nimport '../scss/pickr.scss';\n\n// Import utils\nimport * as _ from './lib/utils';\nimport * as Color from './lib/color';\n\n// Import classes\nimport {HSVaColor} from './lib/hsvacolor';\nimport Moveable from './helper/moveable';\nimport Selectable from './helper/selectable';\n\nclass Pickr {\n\n // Will be used to prevent specific actions during initilization\n _initializingActive = true;\n\n // Replace element with color picker\n _recalc = true;\n\n // Current and last color for comparison\n _color = HSVaColor();\n _lastColor = HSVaColor();\n _swatchColors = [];\n\n // Evenlistener name: [callbacks]\n _eventListener = {\n 'swatchselect': [],\n 'change': [],\n 'save': [],\n 'init': []\n };\n\n constructor(opt) {\n\n // Assign default values\n this.options = opt = Object.assign({\n useAsButton: false,\n disabled: false,\n comparison: true,\n\n components: {\n interaction: {}\n },\n strings: {},\n\n swatches: null,\n inline: false,\n\n default: 'fff',\n defaultRepresentation: null,\n position: 'middle',\n adjustableNumbers: true,\n showAlways: false,\n\n closeWithKey: 'Escape'\n }, opt);\n const {swatches, inline, components} = opt;\n\n // Check interaction section\n if (!components.interaction) {\n components.interaction = {};\n }\n\n // Overwrite palette if preview, opacity or hue are true\n const {preview, opacity, hue, palette} = components;\n components.palette = palette || preview || opacity || hue;\n\n // Per default enabled if inline\n if (inline) {\n opt.showAlways = true;\n }\n\n // Initialize picker\n this._preBuild();\n this._buildComponents();\n this._bindEvents();\n\n // Finalize build\n this._finalBuild();\n\n // Append pre-defined swatch colors\n if (swatches && swatches.length) {\n swatches.forEach(color => this.addSwatch(color));\n }\n\n // Initilization is finish, pickr is visible and ready for usage\n const {button} = this._root;\n requestAnimationFrame((function cb() {\n\n // offsetParent of body is always 0. So check if it is the body\n if (button.offsetParent === null && button !== document.body) {\n return requestAnimationFrame(cb.bind(this));\n }\n\n // Apply default color\n this.setColor(opt.default);\n this._rePositioningPicker();\n\n // Initialize color representation\n if (opt.defaultRepresentation) {\n this._representation = opt.defaultRepresentation;\n this.setColorRepresentation(this._representation);\n }\n\n // Show pickr if locked\n if (opt.showAlways) {\n this.show();\n }\n\n // Initialization is done - pickr is usable, fire init event\n this._initializingActive = false;\n this._emit('init');\n }).bind(this));\n }\n\n // Does only the absolutly basic thing to initialize the components\n _preBuild() {\n const opt = this.options;\n\n // Check if element is selector\n if (typeof opt.el === 'string') {\n\n // Resolve possible shadow dom access\n opt.el = opt.el.split(/>>/g).reduce((pv, cv, ci, a) => {\n pv = pv.querySelector(cv);\n return ci < a.length - 1 ? pv.shadowRoot : pv;\n }, document);\n }\n\n // Create element and append it to body to\n // prevent initialization errors\n this._root = create(opt);\n\n // Check if a custom button is used\n if (opt.useAsButton) {\n this._root.button = opt.el; // Replace button with customized button\n }\n\n document.body.appendChild(this._root.root);\n }\n\n _finalBuild() {\n const opt = this.options;\n const root = this._root;\n\n // Remove from body\n document.body.removeChild(root.root);\n\n if (opt.inline) {\n const {parentElement} = opt.el;\n\n if (parentElement.lastChild === opt.el) {\n parentElement.appendChild(root.app);\n } else {\n parentElement.insertBefore(root.app, opt.el.nextSibling);\n }\n } else {\n document.body.appendChild(root.app);\n }\n\n // Don't replace the the element if a custom button is used\n if (!opt.useAsButton) {\n\n // Replace element with actual color-picker\n opt.el.parentNode.replaceChild(root.root, opt.el);\n }\n\n // Call disable to also add the disabled class\n if (opt.disabled) {\n this.disable();\n }\n\n // Check if color comparison is disabled, if yes - remove transitions so everything keeps smoothly\n if (!opt.comparison) {\n root.button.style.transition = 'none';\n if (!opt.useAsButton) {\n root.preview.lastColor.style.transition = 'none';\n }\n }\n\n this.hide();\n }\n\n _buildComponents() {\n\n // Instance reference\n const inst = this;\n const comp = this.options.components;\n\n const components = {\n\n palette: Moveable({\n element: inst._root.palette.picker,\n wrapper: inst._root.palette.palette,\n\n onchange(x, y) {\n if (!comp.palette) return;\n const {_color, _root, options} = inst;\n\n // Calculate saturation based on the position\n _color.s = (x / this.wrapper.offsetWidth) * 100;\n\n // Calculate the value\n _color.v = 100 - (y / this.wrapper.offsetHeight) * 100;\n\n // Prevent falling under zero\n _color.v < 0 ? _color.v = 0 : 0;\n\n // Set picker and gradient color\n const cssRGBaString = _color.toRGBA().toString();\n this.element.style.background = cssRGBaString;\n this.wrapper.style.background = `\n linear-gradient(to top, rgba(0, 0, 0, ${_color.a}), transparent), \n linear-gradient(to left, hsla(${_color.h}, 100%, 50%, ${_color.a}), rgba(255, 255, 255, ${_color.a}))\n `;\n\n // Check if color is locked\n if (!options.comparison) {\n _root.button.style.color = cssRGBaString;\n\n if (!options.useAsButton) {\n _root.preview.lastColor.style.color = cssRGBaString;\n }\n }\n\n // Change current color\n _root.preview.currentColor.style.color = cssRGBaString;\n\n // Update the input field only if the user is currently not typing\n if (inst._recalc) {\n inst._updateOutput();\n }\n\n // If the user changes the color, remove the cleared icon\n _root.button.classList.remove('clear');\n }\n }),\n\n hue: Moveable({\n lockX: true,\n element: inst._root.hue.picker,\n wrapper: inst._root.hue.slider,\n\n onchange(x, y) {\n if (!comp.hue || !comp.palette) return;\n\n // Calculate hue\n inst._color.h = (y / this.wrapper.offsetHeight) * 360;\n\n // Update color\n this.element.style.backgroundColor = `hsl(${inst._color.h}, 100%, 50%)`;\n components.palette.trigger();\n }\n }),\n\n opacity: Moveable({\n lockX: true,\n element: inst._root.opacity.picker,\n wrapper: inst._root.opacity.slider,\n\n onchange(x, y) {\n if (!comp.opacity || !comp.palette) return;\n\n // Calculate opacity\n inst._color.a = Math.round(((y / this.wrapper.offsetHeight)) * 1e2) / 100;\n\n // Update color\n this.element.style.background = `rgba(0, 0, 0, ${inst._color.a})`;\n inst.components.palette.trigger();\n }\n }),\n\n selectable: Selectable({\n elements: inst._root.interaction.options,\n className: 'active',\n onchange(e) {\n inst._representation = e.target.getAttribute('data-type').toUpperCase();\n inst._updateOutput();\n }\n })\n };\n\n this.components = components;\n }\n\n _bindEvents() {\n const {_root, options} = this;\n\n const eventBindings = [\n\n // Clear color\n _.on(_root.interaction.clear, 'click', () => this._clearColor()),\n\n // Select last color on click\n _.on(_root.preview.lastColor, 'click', () => this.setHSVA(...this._lastColor.toHSVA())),\n\n // Save color\n _.on(_root.interaction.save, 'click', () => {\n !this.applyColor() && !options.showAlways && this.hide();\n }),\n\n // Detect user input and disable auto-recalculation\n _.on(_root.interaction.result, ['keyup', 'input'], e => {\n this._recalc = false;\n\n // Fire listener if initialization is finish and changed color was valid\n if (this.setColor(e.target.value, true) && !this._initializingActive) {\n this._emit('change', this._color);\n }\n\n e.stopImmediatePropagation();\n }),\n\n // Cancel input detection on color change\n _.on([\n _root.palette.palette,\n _root.palette.picker,\n _root.hue.slider,\n _root.hue.picker,\n _root.opacity.slider,\n _root.opacity.picker\n ], ['mousedown', 'touchstart'], () => this._recalc = true)\n ];\n\n // Provide hiding / showing abilities only if showAlways is false\n if (!options.showAlways) {\n const ck = options.closeWithKey;\n\n eventBindings.push(\n // Save and hide / show picker\n _.on(_root.button, 'click', () => this.isOpen() ? this.hide() : this.show()),\n\n // Close with escape key\n _.on(document, 'keyup', e => this.isOpen() && (e.key === ck || e.code === ck) && this.hide()),\n\n // Cancel selecting if the user taps behind the color picker\n _.on(document, ['touchstart', 'mousedown'], e => {\n if (this.isOpen() && !_.eventPath(e).some(el => el === _root.app || el === _root.button)) {\n this.hide();\n }\n }, {capture: true})\n );\n }\n\n // Make input adjustable if enabled\n if (options.adjustableNumbers) {\n _.adjustableInputNumbers(_root.interaction.result, false);\n }\n\n if (!options.inline) {\n let updateTimeout;\n\n // Re-calc position on window resize, scroll and wheel\n eventBindings.push(_.on(window, ['scroll', 'wheel', 'resize'], () => {\n if (this.isOpen()) {\n this.hide();\n\n if (updateTimeout) {\n clearTimeout(updateTimeout);\n }\n\n updateTimeout = setTimeout(() => this.show(), 250);\n }\n }));\n }\n\n // Save bindings\n this._eventBindings = eventBindings;\n }\n\n _rePositioningPicker = (() => {\n const padding = 8;\n let left, top;\n\n return () => {\n\n // No repositioning needed if inline\n if (this.options.inline) {\n return;\n }\n\n const {app, button} = this._root;\n const {innerWidth, innerHeight} = window;\n const bb = button.getBoundingClientRect();\n const ab = app.getBoundingClientRect();\n\n // Check if picker is cuttet of from the top & bottom\n if (innerHeight - (bb.bottom + ab.height + padding) < 0) {\n top = bb.top - ab.height - padding;\n } else {\n top = bb.bottom + padding;\n }\n\n // Positioning picker on the x-axis\n const pos = {\n left: bb.left + bb.width - ab.width,\n middle: (-ab.width / 2) + (bb.left + bb.width / 2),\n right: bb.left\n };\n\n const wantedLeft = pos[this.options.position];\n if (left + wantedLeft > innerWidth) {\n left = pos['left'];\n } else if (wantedLeft < 0) {\n left = pos['right'];\n } else {\n left = wantedLeft;\n }\n\n Object.assign(app.style, {\n left: `${left}px`,\n top: `${top}px`\n });\n };\n })();\n\n _updateOutput() {\n\n // Check if component is present\n if (this._root.interaction.type()) {\n\n // Construct function name and call if present\n const method = `to${this._root.interaction.type().getAttribute('data-type')}`;\n this._root.interaction.result.value = typeof this._color[method] === 'function' ? this._color[method]().toString() : '';\n }\n\n // Fire listener if initialization is finish\n if (!this._initializingActive) {\n this._emit('change', this._color);\n }\n }\n\n _clearColor() {\n const {_root, options} = this;\n\n // Change only the button color if it isn't customized\n if (!options.useAsButton) {\n _root.button.style.color = 'rgba(0, 0, 0, 0.15)';\n }\n\n _root.button.classList.add('clear');\n\n if (!options.showAlways) {\n this.hide();\n }\n\n if (!this._initializingActive) {\n\n // Fire listener\n this._emit('save', null);\n }\n }\n\n _emit(event, ...args) {\n this._eventListener[event].forEach(cb => cb(...args, this));\n }\n\n on(event, cb) {\n\n // Validate\n if (typeof cb === 'function' && typeof event === 'string' && event in this._eventListener) {\n this._eventListener[event].push(cb);\n }\n\n return this;\n }\n\n off(event, cb) {\n const callBacks = this._eventListener[event];\n\n if (callBacks) {\n const index = callBacks.indexOf(cb);\n\n if (~index) {\n callBacks.splice(index, 1);\n }\n }\n\n return this;\n }\n\n /**\n * Appends a color to the swatch palette\n * @param color\n * @returns {boolean}\n */\n addSwatch(color) {\n const {values} = Color.parseToHSV(color);\n\n if (values) {\n const {_swatchColors, _root} = this;\n const hsvaColorObject = HSVaColor(...values);\n\n // Create new swatch HTMLElement\n const element = _.createElementFromString(\n ``\n );\n\n // Append element and save swatch data\n _root.swatches.appendChild(element);\n _swatchColors.push({element, hsvaColorObject});\n\n // Bind event\n this._eventBindings.push(\n _.on(element, 'click', () => {\n this.setHSVA(...hsvaColorObject.toHSVA(), true);\n this._emit('swatchselect', hsvaColorObject);\n })\n );\n\n return true;\n }\n\n return false;\n }\n\n /**\n * Removes a swatch color by it's index\n * @param index\n * @returns {boolean}\n */\n removeSwatch(index) {\n\n // Validate index\n if (typeof index === 'number') {\n const swatchColor = this._swatchColors[index];\n\n // Check swatch data\n if (swatchColor) {\n const {element} = swatchColor;\n\n // Remove HTML child and swatch data\n this._root.swatches.removeChild(element);\n this._swatchColors.splice(index, 1);\n return true;\n }\n }\n\n return false;\n }\n\n applyColor(silent = false) {\n const {preview, button} = this._root;\n\n // Change preview and current color\n const cssRGBaString = this._color.toRGBA().toString();\n preview.lastColor.style.color = cssRGBaString;\n\n // Change only the button color if it isn't customized\n if (!this.options.useAsButton) {\n button.style.color = cssRGBaString;\n }\n\n // User changed the color so remove the clear clas\n button.classList.remove('clear');\n\n // Save last color\n this._lastColor = this._color.clone();\n\n // Fire listener\n if (!this._initializingActive && !silent) {\n this._emit('save', this._color);\n }\n }\n\n /**\n * Destroy's all functionalitys\n */\n destroy() {\n this._eventBindings.forEach(args => _.off(...args));\n Object.keys(this.components).forEach(key => this.components[key].destroy());\n }\n\n /**\n * Destroy's all functionalitys and removes\n * the pickr element.\n */\n destroyAndRemove() {\n this.destroy();\n\n // Remove element\n const root = this._root.root;\n root.parentElement.removeChild(root);\n\n // remove .pcr-app\n const app = this._root.app;\n app.parentElement.removeChild(app);\n\n // There are references to various DOM elements stored in the pickr instance\n // This cleans all of them to avoid detached DOMs\n const pickr = this;\n Object.keys(pickr).forEach(key => pickr[key] = null);\n }\n\n /**\n * Hides the color-picker ui.\n */\n hide() {\n this._root.app.classList.remove('visible');\n return this;\n }\n\n /**\n * Shows the color-picker ui.\n */\n show() {\n if (this.options.disabled) return;\n this._root.app.classList.add('visible');\n this._rePositioningPicker();\n return this;\n }\n\n /**\n * @return {boolean} If the color picker is currently open\n */\n isOpen() {\n return this._root.app.classList.contains('visible');\n }\n\n /**\n * Set a specific color.\n * @param h Hue\n * @param s Saturation\n * @param v Value\n * @param a Alpha channel (0 - 1)\n * @param silent If the button should not change the color\n * @return boolean if the color has been accepted\n */\n setHSVA(h = 360, s = 0, v = 0, a = 1, silent = false) {\n\n // Deactivate color calculation\n const recalc = this._recalc; // Save state\n this._recalc = false;\n\n // Validate input\n if (h < 0 || h > 360 || s < 0 || s > 100 || v < 0 || v > 100 || a < 0 || a > 1) {\n return false;\n }\n\n // Short names\n const {hue, opacity, palette} = this.components;\n\n // Calculate y position of hue slider\n const hueWrapper = hue.options.wrapper;\n const hueY = hueWrapper.offsetHeight * (h / 360);\n hue.update(0, hueY);\n\n // Calculate y position of opacity slider\n const opacityWrapper = opacity.options.wrapper;\n const opacityY = opacityWrapper.offsetHeight * a;\n opacity.update(0, opacityY);\n\n // Calculate y and x position of color palette\n const pickerWrapper = palette.options.wrapper;\n const pickerX = pickerWrapper.offsetWidth * (s / 100);\n const pickerY = pickerWrapper.offsetHeight * (1 - (v / 100));\n palette.update(pickerX, pickerY);\n\n // Override current color and re-active color calculation\n this._color = HSVaColor(h, s, v, a);\n this._recalc = recalc; // Restore old state\n\n // Update output if recalculation is enabled\n if (this._recalc) {\n this._updateOutput();\n }\n\n // Check if call is silent\n if (!silent) {\n this.applyColor();\n }\n\n return true;\n }\n\n /**\n * Tries to parse a string which represents a color.\n * Examples: #fff\n * rgb 10 10 200\n * hsva 10 20 5 0.5\n * @param string\n * @param silent\n */\n setColor(string, silent = false) {\n\n // Check if null\n if (string === null) {\n this._clearColor();\n return true;\n }\n\n const {values, type} = Color.parseToHSV(string);\n\n // Check if color is ok\n if (values) {\n\n // Change selected color format\n const utype = type.toUpperCase();\n const {options} = this._root.interaction;\n const target = options.find(el => el.getAttribute('data-type').startsWith(utype));\n\n // Auto select only if not hidden\n if (target && !target.hidden) {\n for (const el of options) {\n el.classList[el === target ? 'add' : 'remove']('active');\n }\n }\n\n return this.setHSVA(...values, silent);\n }\n }\n\n /**\n * Changes the color _representation.\n * Allowed values are HEX, RGB, HSV, HSL and CMYK\n * @param type\n * @returns {boolean} if the selected type was valid.\n */\n setColorRepresentation(type) {\n\n // Force uppercase to allow a case-sensitiv comparison\n type = type.toUpperCase();\n\n // Find button with given type and trigger click event\n return !!this._root.interaction.options.find(v => v.getAttribute('data-type').startsWith(type) && !v.click());\n }\n\n /**\n * Returns the current color representaion. See setColorRepresentation\n * @returns {*}\n */\n getColorRepresentation() {\n return this._representation;\n }\n\n /**\n * @returns HSVaColor Current HSVaColor object.\n */\n getColor() {\n return this._color;\n }\n\n /**\n * @returns The root HTMLElement with all his components.\n */\n getRoot() {\n return this._root;\n }\n\n /**\n * Disable pickr\n */\n disable() {\n this.hide();\n this.options.disabled = true;\n this._root.button.classList.add('disabled');\n return this;\n }\n\n /**\n * Enable pickr\n */\n enable() {\n this.options.disabled = false;\n this._root.button.classList.remove('disabled');\n return this;\n }\n}\n\nfunction create(options) {\n const {components, strings, useAsButton, inline} = options;\n const hidden = con => con ? '' : 'style=\"display:none\" hidden';\n\n const root = _.createFromTemplate(`\n
\n \n ${useAsButton ? '' : ''}\n\n
\n
\n
\n \n
\n
\n\n
\n
\n
\n
\n\n
\n
\n
\n
\n\n
\n
\n
\n
\n
\n\n
\n\n
\n \n\n \n \n \n \n \n\n \n \n
\n
\n
\n `);\n\n const int = root.interaction;\n\n // Select option which is not hidden\n int.options.find(o => !o.hidden && !o.classList.add('active'));\n\n // Create method to find currenlty active option\n int.type = () => int.options.find(e => e.classList.contains('active'));\n return root;\n}\n\n// Static methods\nPickr.utils = {\n once: _.once,\n on: _.on,\n off: _.off,\n eventPath: _.eventPath,\n createElementFromString: _.createElementFromString,\n adjustableInputNumbers: _.adjustableInputNumbers,\n removeAttribute: _.removeAttribute,\n createFromTemplate: _.createFromTemplate\n};\n\n// Create instance via method\nPickr.create = (options) => new Pickr(options);\n\n// Export\nPickr.version = '0.5.0';\nexport default Pickr;\n"],"sourceRoot":""} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 833a384a..3c0f373f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@simonwep/pickr", - "version": "0.4.11", + "version": "0.5.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index a82a9226..6f4ca828 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@simonwep/pickr", - "version": "0.4.11", + "version": "0.5.0", "license": "MIT", "author": "Simon Reinisch ", "description": "Flat, Simple, Hackable Color-Picker.", diff --git a/src/js/pickr.js b/src/js/pickr.js index 9eff7270..43885b2c 100644 --- a/src/js/pickr.js +++ b/src/js/pickr.js @@ -844,5 +844,5 @@ Pickr.utils = { Pickr.create = (options) => new Pickr(options); // Export -Pickr.version = '0.4.11'; +Pickr.version = '0.5.0'; export default Pickr;