diff --git a/dist/pickr.es5.min.js b/dist/pickr.es5.min.js index bbfd8a45..5cee3832 100644 --- a/dist/pickr.es5.min.js +++ b/dist/pickr.es5.min.js @@ -1,3 +1,3 @@ /*! Pickr 0.6.4 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=0)}([function(t,e,n){"use strict";n.r(e);var r={};function o(t){for(var e=1;e4&&void 0!==arguments[4]?arguments[4]:{};e instanceof HTMLCollection||e instanceof NodeList?e=Array.from(e):Array.isArray(e)||(e=[e]),Array.isArray(n)||(n=[n]);var a=!0,c=!1,s=void 0;try{for(var u,l=e[Symbol.iterator]();!(a=(u=l.next()).done);a=!0){var p=u.value,h=!0,d=!1,f=void 0;try{for(var v,y=n[Symbol.iterator]();!(h=(v=y.next()).done);h=!0){var m=v.value;p[t](m,r,o({capture:!1},i))}}catch(t){d=!0,f=t}finally{try{h||null==y.return||y.return()}finally{if(d)throw f}}}}catch(t){c=!0,s=t}finally{try{a||null==l.return||l.return()}finally{if(c)throw s}}return Array.prototype.slice.call(arguments,1)}function u(t){var e=document.createElement("div");return e.innerHTML=t.trim(),e.firstElementChild}function l(t,e){var n=t.getAttribute(e);return t.removeAttribute(e),n}function p(t){return function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=l(e,"data-con"),o=l(e,"data-key");o&&(n[o]=e);for(var i=r?n[r]={}:n,a=0,c=Array.from(e.children);a1&&void 0!==arguments[1]?arguments[1]:function(t){return t};function n(n){var r=[.001,.01,.1][Number(n.shiftKey||2*n.ctrlKey)]*(n.deltaY<0?1:-1),o=0,i=t.selectionStart;t.value=t.value.replace(/[\d.]+/g,function(t,n){return n<=i&&n+t.length>=i?(i=n,e(Number(t),r,o)):(o++,t)}),t.focus(),t.setSelectionRange(i,i),n.preventDefault(),t.dispatchEvent(new Event("input"))}a(t,"focus",function(){return a(window,"wheel",n,{passive:!1})}),a(t,"blur",function(){return c(window,"wheel",n)})}function f(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 v(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 k(t,e,n,r){return e/=100,n/=100,v(w(255*(1-y(1,(t/=100)*(1-(r/=100))+r)),255*(1-y(1,e*(1-r)+r)),255*(1-y(1,n*(1-r)+r))))}function A(t,e,n){return e/=100,[t,2*(e*=(n/=100)<.5?n:1-n)/(n+e)*100,100*(n+e)]}function C(t){return w.apply(void 0,v(t.match(/.{2}/g).map(function(t){return parseInt(t,16)})))}function S(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=f(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(v(k(s,u,l,p)),[1]),type:a};case"rgba":var h=f(i(r),6),d=h[2],y=h[3],m=h[4],b=h[5],g=void 0===b?1:b;if(d>255||y>255||m>255||g<0||g>1)break;return{values:[].concat(v(w(d,y,m)),[g]),type:a};case"hex":var _=function(t,e){return[t.substring(0,e),t.substring(e,t.length)]},S=f(r,2)[1];3===S.length?S+="F":6===S.length&&(S+="FF");var O=void 0;if(4===S.length){var j=f(_(S,3).map(function(t){return t+t}),2);S=j[0],O=j[1]}else if(8===S.length){var x=f(_(S,6),2);S=x[0],O=x[1]}return O=parseInt(O,16)/255,{values:[].concat(v(C(S)),[O]),type:a};case"hsla":var E=f(i(r),6),P=E[2],B=E[3],L=E[4],R=E[5],H=void 0===R?1:R;if(P>360||B>100||L>100||H<0||H>1)break;return{values:[].concat(v(A(P,B,L)),[H]),type:a};case"hsva":var D=f(i(r),6),M=D[2],F=D[3],T=D[4],N=D[5],I=void 0===N?1:N;if(M>360||F>100||T>100||I<0||I>1)break;return{values:[M,F,T,I],type:a}}return{values:null,type:null}}function O(){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,o=Math.ceil,i={h:t,s:e,v:n,a:r,toHSVA:function(){var t=[i.h,i.s,i.v],e=t.map(o);return t.push(i.a),t.toString=function(){return"hsva(".concat(e[0],", ").concat(e[1],"%, ").concat(e[2],"%, ").concat(i.a.toFixed(1),")")},t},toHSLA:function(){var t=function(t,e,n){var r=(2-(e/=100))*(n/=100)/2;return 0!==r&&(e=1===r?0:r<.5?e*n/(2*r):e*n/(2-2*r)),[t,100*e,100*r]}(i.h,i.s,i.v),e=t.map(o);return t.push(i.a),t.toString=function(){return"hsla(".concat(e[0],", ").concat(e[1],"%, ").concat(e[2],"%, ").concat(i.a.toFixed(1),")")},t},toRGBA:function(){var t=_(i.h,i.s,i.v),e=t.map(o);return t.push(i.a),t.toString=function(){return"rgba(".concat(e[0],", ").concat(e[1],", ").concat(e[2],", ").concat(i.a.toFixed(1),")")},t},toCMYK:function(){var t=function(t,e,n){var r,o=_(t,e,n),i=o[0]/255,a=o[1]/255,c=o[2]/255;return[100*(1===(r=y(1-i,1-a,1-c))?0:(1-i-r)/(1-r)),100*(1===r?0:(1-a-r)/(1-r)),100*(1===r?0:(1-c-r)/(1-r)),100*r]}(i.h,i.s,i.v),e=t.map(o);return t.toString=function(){return"cmyk(".concat(e[0],"%, ").concat(e[1],"%, ").concat(e[2],"%, ").concat(e[3],"%)")},t},toHEXA:function(){var t=function(t,e,n){return _(t,e,n).map(function(t){return g(t).toString(16).padStart(2,"0")})}(i.h,i.s,i.v);return t.toString=function(){var e=i.a>=1?"":Number((255*i.a).toFixed(0)).toString(16).toUpperCase().padStart(2,"0");return"#".concat(t.join("").toUpperCase()+e)},t},clone:function(){return O(i.h,i.s,i.v,i.a)}};return i}var j=function(t){return Math.max(Math.min(t,1),0)};function x(t){var e={options:Object.assign({lock:null,onchange:function(){return 0}},t),_tapstart:function(t){a(document,["mouseup","touchend","touchcancel"],e._tapstop),a(document,["mousemove","touchmove"],e._tapmove),t.preventDefault(),e._tapmove(t)},_tapmove:function(t){var r=e.options.lock,o=e.cache,i=n.element,a=n.wrapper,c=a.getBoundingClientRect(),s=0,u=0;if(t){var l=t&&t.touches&&t.touches[0];s=t?(l||t).clientX:0,u=t?(l||t).clientY:0,sc.left+c.width&&(s=c.left+c.width),uc.top+c.height&&(u=c.top+c.height),s-=c.left,u-=c.top}else o&&(s=o.x*c.width,u=o.y*c.height);"h"!==r&&(i.style.left="calc(".concat(s/c.width*100,"% - ").concat(i.offsetWidth/2,"px)")),"v"!==r&&(i.style.top="calc(".concat(u/c.height*100,"% - ").concat(i.offsetHeight/2,"px)")),e.cache={x:s/c.width,y:u/c.height};var p=j(s/a.offsetWidth),h=j(u/a.offsetHeight);switch(r){case"v":return n.onchange(p);case"h":return n.onchange(h);default:return n.onchange(p,h)}},_tapstop:function(){c(document,["mouseup","touchend","touchcancel"],e._tapstop),c(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(),o=r.left,i=r.top,a=r.width,c=r.height;e._tapmove({clientX:o+a*t,clientY:i+c*n})},destroy:function(){var t=e.options,n=e._tapstart;c([t.wrapper,t.element],"mousedown",n),c([t.wrapper,t.element],"touchstart",n,{passive:!1})}},n=e.options,r=e._tapstart;return a([n.wrapper,n.element],"mousedown",r),a([n.wrapper,n.element],"touchstart",r,{passive:!1}),e}function E(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=a(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 c.apply(r,E(e))}}}function B(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 L(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e0&&d+a>/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 ")),(s=c.interaction).options.find(function(t){return!t.hidden&&!t.classList.add("active")}),s.type=function(){return s.options.find(function(t){return t.classList.contains("active")})},c),u.useAsButton&&(this._root.button=u.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=function(){var e=t.options.sliders,n="v",r="v";if(e.match(/^[vh]+$/g))if(e.length>1){var o=R(e,2);n=o[0],r=o[1]}else n=r=e;var i={v:"h",h:"v"};return[i[n],i[r]]}(),r=R(n,2),o=r[0],i=r[1],a={palette:x({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=100*n,o.v=100-100*r,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(),t.options.comparison||i.button.classList.remove("clear")}}}),hue:x({lock:i,element:t._root.hue.picker,wrapper:t._root.hue.slider,onchange:function(n){e.hue&&e.palette&&(t._color.h=360*n,this.element.style.backgroundColor="hsl(".concat(t._color.h,", 100%, 50%)"),a.palette.trigger())}}),opacity:x({lock:o,element:t._root.opacity.picker,wrapper:t._root.opacity.slider,onchange:function(n){e.opacity&&e.palette&&(t._color.a=Math.round(100*n)/100,this.element.style.background="rgba(0, 0, 0, ".concat(t._color.a,")"),t.components.palette.trigger())}}),selectable:P({elements:t._root.interaction.options,className:"active",onchange:function(e){t._representation=e.target.getAttribute("data-type").toUpperCase(),t._updateOutput()}})};this.components=a}},{key:"_bindEvents",value:function(){var t=this,e=this._root,n=this.options,r=[a(e.interaction.clear,"click",function(){return t._clearColor()}),a(e.preview.lastColor,"click",function(){return t.setHSVA.apply(t,L(t._lastColor.toHSVA()))}),a(e.interaction.save,"click",function(){!t.applyColor()&&!n.showAlways&&t.hide()}),a(e.interaction.result,["keyup","input"],function(e){t._recalc=!1,t.setColor(e.target.value,!0)&&!t._initializingActive&&t._emit("change",t._color),e.stopImmediatePropagation()}),a([e.palette.palette,e.palette.picker,e.hue.slider,e.hue.picker,e.opacity.slider,e.opacity.picker],["mousedown","touchstart"],function(){return t._recalc=!0})];if(!n.showAlways){var o=n.closeWithKey;r.push(a(e.button,"click",function(){return t.isOpen()?t.hide():t.show()}),a(document,"keyup",function(e){return t.isOpen()&&(e.key===o||e.code===o)&&t.hide()}),a(document,["touchstart","mousedown"],function(n){t.isOpen()&&!h(n).some(function(t){return t===e.app||t===e.button})&&t.hide()},{capture:!0}))}if(n.adjustableNumbers){var i={rgba:[255,255,255,1],hsva:[360,100,100,1],hsla:[360,100,100,1],cmyk:[100,100,100,100]};d(e.interaction.result,function(e,n,r){var o=i[t.getColorRepresentation().toLowerCase()];if(o){var a=o[r],c=e+(a>=100?1e3*n:n);return c<=0?0:Number((c1?n-1:0),o=1;o'));return o.swatches.appendChild(c),r.push({element:c,hsvaColorObject:i}),this._eventBindings.push(a(c,"click",function(){e.setHSVA.apply(e,L(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 c.apply(r,L(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;this._color=O(t,e,n,r);var a=this.components,c=a.hue,s=a.opacity,u=a.palette;return c.update(0,t/360),s.update(0,r),u.update(e/100,1-n/100),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=S(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,L(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}}])&&H(e.prototype,n),o&&H(e,o),t}();M.utils=r,M.create=function(t){return new M(t)},M.version="0.6.4";e.default=M}]).default}); +!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=0)}([function(t,e,n){"use strict";n.r(e);var r={};function o(t){for(var e=1;e4&&void 0!==arguments[4]?arguments[4]:{};e instanceof HTMLCollection||e instanceof NodeList?e=Array.from(e):Array.isArray(e)||(e=[e]),Array.isArray(n)||(n=[n]);var a=!0,c=!1,s=void 0;try{for(var u,l=e[Symbol.iterator]();!(a=(u=l.next()).done);a=!0){var p=u.value,h=!0,d=!1,f=void 0;try{for(var v,y=n[Symbol.iterator]();!(h=(v=y.next()).done);h=!0){var m=v.value;p[t](m,r,o({capture:!1},i))}}catch(t){d=!0,f=t}finally{try{h||null==y.return||y.return()}finally{if(d)throw f}}}}catch(t){c=!0,s=t}finally{try{a||null==l.return||l.return()}finally{if(c)throw s}}return Array.prototype.slice.call(arguments,1)}function u(t){var e=document.createElement("div");return e.innerHTML=t.trim(),e.firstElementChild}function l(t,e){var n=t.getAttribute(e);return t.removeAttribute(e),n}function p(t){return function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=l(e,"data-con"),o=l(e,"data-key");o&&(n[o]=e);for(var i=r?n[r]={}:n,a=0,c=Array.from(e.children);a1&&void 0!==arguments[1]?arguments[1]:function(t){return t};function n(n){var r=[.001,.01,.1][Number(n.shiftKey||2*n.ctrlKey)]*(n.deltaY<0?1:-1),o=0,i=t.selectionStart;t.value=t.value.replace(/[\d.]+/g,function(t,n){return n<=i&&n+t.length>=i?(i=n,e(Number(t),r,o)):(o++,t)}),t.focus(),t.setSelectionRange(i,i),n.preventDefault(),t.dispatchEvent(new Event("input"))}a(t,"focus",function(){return a(window,"wheel",n,{passive:!1})}),a(t,"blur",function(){return c(window,"wheel",n)})}function f(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 v(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 k(t,e,n,r){return e/=100,n/=100,v(w(255*(1-y(1,(t/=100)*(1-(r/=100))+r)),255*(1-y(1,e*(1-r)+r)),255*(1-y(1,n*(1-r)+r))))}function A(t,e,n){return e/=100,[t,2*(e*=(n/=100)<.5?n:1-n)/(n+e)*100,100*(n+e)]}function C(t){return w.apply(void 0,v(t.match(/.{2}/g).map(function(t){return parseInt(t,16)})))}function S(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=f(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(v(k(s,u,l,p)),[1]),type:a};case"rgba":var h=f(i(r),6),d=h[2],y=h[3],m=h[4],g=h[5],b=void 0===g?1:g;if(d>255||y>255||m>255||b<0||b>1)break;return{values:[].concat(v(w(d,y,m)),[b]),type:a};case"hex":var _=function(t,e){return[t.substring(0,e),t.substring(e,t.length)]},S=f(r,2)[1];3===S.length?S+="F":6===S.length&&(S+="FF");var O=void 0;if(4===S.length){var j=f(_(S,3).map(function(t){return t+t}),2);S=j[0],O=j[1]}else if(8===S.length){var x=f(_(S,6),2);S=x[0],O=x[1]}return O=parseInt(O,16)/255,{values:[].concat(v(C(S)),[O]),type:a};case"hsla":var E=f(i(r),6),P=E[2],B=E[3],L=E[4],R=E[5],H=void 0===R?1:R;if(P>360||B>100||L>100||H<0||H>1)break;return{values:[].concat(v(A(P,B,L)),[H]),type:a};case"hsva":var D=f(i(r),6),M=D[2],F=D[3],T=D[4],N=D[5],V=void 0===N?1:N;if(M>360||F>100||T>100||V<0||V>1)break;return{values:[M,F,T,V],type:a}}return{values:null,type:null}}function O(){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,o=Math.ceil,i={h:t,s:e,v:n,a:r,toHSVA:function(){var t=[i.h,i.s,i.v],e=t.map(o);return t.push(i.a),t.toString=function(){return"hsva(".concat(e[0],", ").concat(e[1],"%, ").concat(e[2],"%, ").concat(i.a.toFixed(1),")")},t},toHSLA:function(){var t=function(t,e,n){var r=(2-(e/=100))*(n/=100)/2;return 0!==r&&(e=1===r?0:r<.5?e*n/(2*r):e*n/(2-2*r)),[t,100*e,100*r]}(i.h,i.s,i.v),e=t.map(o);return t.push(i.a),t.toString=function(){return"hsla(".concat(e[0],", ").concat(e[1],"%, ").concat(e[2],"%, ").concat(i.a.toFixed(1),")")},t},toRGBA:function(){var t=_(i.h,i.s,i.v),e=t.map(o);return t.push(i.a),t.toString=function(){return"rgba(".concat(e[0],", ").concat(e[1],", ").concat(e[2],", ").concat(i.a.toFixed(1),")")},t},toCMYK:function(){var t=function(t,e,n){var r,o=_(t,e,n),i=o[0]/255,a=o[1]/255,c=o[2]/255;return[100*(1===(r=y(1-i,1-a,1-c))?0:(1-i-r)/(1-r)),100*(1===r?0:(1-a-r)/(1-r)),100*(1===r?0:(1-c-r)/(1-r)),100*r]}(i.h,i.s,i.v),e=t.map(o);return t.toString=function(){return"cmyk(".concat(e[0],"%, ").concat(e[1],"%, ").concat(e[2],"%, ").concat(e[3],"%)")},t},toHEXA:function(){var t=function(t,e,n){return _(t,e,n).map(function(t){return b(t).toString(16).padStart(2,"0")})}(i.h,i.s,i.v);return t.toString=function(){var e=i.a>=1?"":Number((255*i.a).toFixed(0)).toString(16).toUpperCase().padStart(2,"0");return"#".concat(t.join("").toUpperCase()+e)},t},clone:function(){return O(i.h,i.s,i.v,i.a)}};return i}var j=function(t){return Math.max(Math.min(t,1),0)};function x(t){var e={options:Object.assign({lock:null,onchange:function(){return 0}},t),_tapstart:function(t){a(document,["mouseup","touchend","touchcancel"],e._tapstop),a(document,["mousemove","touchmove"],e._tapmove),t.preventDefault(),e._tapmove(t)},_tapmove:function(t){var r=e.options.lock,o=e.cache,i=n.element,a=n.wrapper,c=a.getBoundingClientRect(),s=0,u=0;if(t){var l=t&&t.touches&&t.touches[0];s=t?(l||t).clientX:0,u=t?(l||t).clientY:0,sc.left+c.width&&(s=c.left+c.width),uc.top+c.height&&(u=c.top+c.height),s-=c.left,u-=c.top}else o&&(s=o.x*c.width,u=o.y*c.height);"h"!==r&&(i.style.left="calc(".concat(s/c.width*100,"% - ").concat(i.offsetWidth/2,"px)")),"v"!==r&&(i.style.top="calc(".concat(u/c.height*100,"% - ").concat(i.offsetHeight/2,"px)")),e.cache={x:s/c.width,y:u/c.height};var p=j(s/a.offsetWidth),h=j(u/a.offsetHeight);switch(r){case"v":return n.onchange(p);case"h":return n.onchange(h);default:return n.onchange(p,h)}},_tapstop:function(){c(document,["mouseup","touchend","touchcancel"],e._tapstop),c(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(),o=r.left,i=r.top,a=r.width,c=r.height;e._tapmove({clientX:o+a*t,clientY:i+c*n})},destroy:function(){var t=e.options,n=e._tapstart;c([t.wrapper,t.element],"mousedown",n),c([t.wrapper,t.element],"touchstart",n,{passive:!1})}},n=e.options,r=e._tapstart;return a([n.wrapper,n.element],"mousedown",r),a([n.wrapper,n.element],"touchstart",r,{passive:!1}),e}function E(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=a(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 c.apply(r,E(e))}}}function B(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 L(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e0&&void 0!==arguments[0]?arguments[0]:{};return function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t[e];if(n)return n;var r=B(e.split("-"),2),o=r[0],i=r[1],a=void 0===i?"middle":i,c="top"===o||"bottom"===o;return t[e]={position:o,variant:a,isVertical:c}}}(),{update:function(t){var e=f(t),n=e.position,r=e.variant,o=e.isVertical,i=u.getBoundingClientRect(),a=s.getBoundingClientRect(),c=o?{t:i.top-a.height-p,b:i.bottom+p}:{r:i.right+p,l:i.left-a.width-p},l=o?{s:i.left+i.width-a.width,m:-a.width/2+(i.left+i.width/2),e:i.left}:{s:i.bottom-a.height,m:i.bottom-i.height/2-a.height/2,e:i.bottom-i.height};function v(t,e,n){var r="top"===n,o=r?a.height:a.width,i=window[r?"innerHeight":"innerWidth"],c=!0,u=!1,l=void 0;try{for(var p,h=t[Symbol.iterator]();!(c=(p=h.next()).done);c=!0){var d=e[p.value];if(d>0&&d+o>/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 ")),(s=c.interaction).options.find(function(t){return!t.hidden&&!t.classList.add("active")}),s.type=function(){return s.options.find(function(t){return t.classList.contains("active")})},c),u.useAsButton&&(this._root.button=u.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=function(){var e=t.options.sliders,n="v",r="v";if(e.match(/^[vh]+$/g))if(e.length>1){var o=R(e,2);n=o[0],r=o[1]}else n=r=e;var i={v:"h",h:"v"};return[i[n],i[r]]}(),r=R(n,2),o=r[0],i=r[1],a={palette:x({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=100*n,o.v=100-100*r,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(),t.options.comparison||i.button.classList.remove("clear")}}}),hue:x({lock:i,element:t._root.hue.picker,wrapper:t._root.hue.slider,onchange:function(n){e.hue&&e.palette&&(t._color.h=360*n,this.element.style.backgroundColor="hsl(".concat(t._color.h,", 100%, 50%)"),a.palette.trigger())}}),opacity:x({lock:o,element:t._root.opacity.picker,wrapper:t._root.opacity.slider,onchange:function(n){e.opacity&&e.palette&&(t._color.a=Math.round(100*n)/100,this.element.style.background="rgba(0, 0, 0, ".concat(t._color.a,")"),t.components.palette.trigger())}}),selectable:P({elements:t._root.interaction.options,className:"active",onchange:function(e){t._representation=e.target.getAttribute("data-type").toUpperCase(),t._updateOutput()}})};this.components=a}},{key:"_bindEvents",value:function(){var t=this,e=this._root,n=this.options,r=[a(e.interaction.clear,"click",function(){return t._clearColor()}),a(e.preview.lastColor,"click",function(){return t.setHSVA.apply(t,L(t._lastColor.toHSVA()))}),a(e.interaction.save,"click",function(){!t.applyColor()&&!n.showAlways&&t.hide()}),a(e.interaction.result,["keyup","input"],function(e){t._recalc=!1,t.setColor(e.target.value,!0)&&!t._initializingActive&&t._emit("change",t._color),e.stopImmediatePropagation()}),a([e.palette.palette,e.palette.picker,e.hue.slider,e.hue.picker,e.opacity.slider,e.opacity.picker],["mousedown","touchstart"],function(){return t._recalc=!0})];if(!n.showAlways){var o=n.closeWithKey;r.push(a(e.button,"click",function(){return t.isOpen()?t.hide():t.show()}),a(document,"keyup",function(e){return t.isOpen()&&(e.key===o||e.code===o)&&t.hide()}),a(document,["touchstart","mousedown"],function(n){t.isOpen()&&!h(n).some(function(t){return t===e.app||t===e.button})&&t.hide()},{capture:!0}))}if(n.adjustableNumbers){var i={rgba:[255,255,255,1],hsva:[360,100,100,1],hsla:[360,100,100,1],cmyk:[100,100,100,100]};d(e.interaction.result,function(e,n,r){var o=i[t.getColorRepresentation().toLowerCase()];if(o){var a=o[r],c=e+(a>=100?1e3*n:n);return c<=0?0:Number((c1?n-1:0),o=1;o'));return o.swatches.appendChild(c),r.push({element:c,hsvaColorObject:i}),this._eventBindings.push(a(c,"click",function(){e.setHSVA.apply(e,L(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 c.apply(r,L(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;this._color=O(t,e,n,r);var a=this.components,c=a.hue,s=a.opacity,u=a.palette;return c.update(0,t/360),s.update(0,r),u.update(e/100,1-n/100),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=S(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,L(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}}])&&H(e.prototype,n),o&&H(e,o),t}();M.utils=r,M.create=function(t){return new M(t)},M.version="0.6.4";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 9f230389..b4ba237a 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/utils/utils.js","webpack:///./src/js/utils/color.js","webpack:///./src/js/utils/hsvacolor.js","webpack:///./src/js/libs/moveable.js","webpack:///./src/js/libs/selectable.js","webpack:///./src/js/pickr.js","webpack:///./src/js/libs/nanopop.js","webpack:///./src/js/template.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","_iteratorNormalCompletion","_didIteratorError","_iteratorError","_step","_iterator","iterator","next","done","el","_iteratorNormalCompletion2","_didIteratorError2","_iteratorError2","_step2","_iterator2","ev","_objectSpread","capture","err","return","slice","createElementFromString","html","div","document","createElement","innerHTML","trim","firstElementChild","removeAttribute","getAttribute","createFromTemplate","str","resolve","element","base","con","subtree","_i","_Array$from","children","child","arr","push","eventPath","evt","path","composedPath","target","parentElement","adjustableInputNumbers","mapper","v","handleScroll","e","inc","Number","shiftKey","ctrlKey","deltaY","index","selectionStart","replace","focus","setSelectionRange","preventDefault","dispatchEvent","Event","passive","min","Math","max","floor","round","hsvToRgb","h","f","q","mod","rgbToHsv","g","b","minVal","maxVal","delta","dr","dg","db","cmykToHsv","y","k","_toConsumableArray","hslToHsv","hexToHsv","hex","apply","match","map","parseInt","parseToHSV","ctx","getContext","fillStyle","regex","cmyk","rgba","hsla","hsva","numarize","array","test","type","exec","_numarize2","_slicedToArray","values","concat","_numarize4","_numarize4$","a","splitAt","substring","alpha","_splitAt$map2","_splitAt2","_numarize6","_numarize6$","_numarize8","_numarize8$","HSVaColor","ceil","that","toHSVA","rhsva","toString","toFixed","toHSLA","hsvToHsl","rhsla","toRGBA","rrgba","toCMYK","rgb","hsvToCmyk","rcmyk","toHEXA","padStart","hsvToHex","toUpperCase","join","clone","clamp","Moveable","opt","assign","lock","onchange","_tapstart","_","_tapstop","_tapmove","cache","wrapper","getBoundingClientRect","x","touch","touches","clientX","clientY","left","width","top","height","style","offsetWidth","offsetHeight","cx","cy","trigger","update","_that$options$wrapper","destroy","Selectable","className","onTap","forEach","classList","selectable_toConsumableArray","Pickr","_this","this","_classCallCheck","pickr_defineProperty","swatchselect","change","save","init","appClass","useAsButton","disabled","comparison","components","interaction","strings","swatches","inline","sliders","default","defaultRepresentation","position","adjustableNumbers","showAlways","closeWithKey","_opt","preview","opacity","hue","palette","_preBuild","_buildComponents","_bindEvents","_finalBuild","color","addSwatch","_nanopop","_ref","reference","pos","_ref$padding","padding","vBehaviour","start","middle","end","hBehaviour","right","bottom","_pos$split2","nanopop_slicedToArray","split","_pos$split2$","variant","isVertical","rb","eb","positions","variants","bevs","vars","styleprop","vertical","adder","win","Nanopop","_root","button","app","requestAnimationFrame","cb","offsetParent","body","setColor","_rePositioningPicker","_representation","setColorRepresentation","show","_initializingActive","_emit","hidden","int","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","so","sh","_sliders","pickr_slicedToArray","opposite","_ref2","picker","_color","cssRGBaString","background","currentColor","_recalc","_updateOutput","remove","slider","backgroundColor","selectable","_this2","eventBindings","_clearColor","setHSVA","pickr_toConsumableArray","_lastColor","applyColor","result","stopImmediatePropagation","ck","isOpen","code","some","ranges","step","range","getColorRepresentation","toLowerCase","nv","toPrecision","timeout","setTimeout","rs","clearTimeout","_eventBindings","event","_this3","_len","args","_key","_eventListener","callBacks","indexOf","splice","_this4","Color","_swatchColors","hsvaColorObject","swatchColor","silent","_this$_root","_this5","pickr","recalc","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AAc,QAAAd,EAAAc,SAAA,WAAAjB,EAAA,MAAAC,IAM9B,OAAO2L,KAAK6H,QAAL5N,MAAA+F,KAAA8H,EAAgBzM,GAAhBC,OAAA,CAAwB2O,qDAUhBhP,GAMnB,OAHAA,EAAOA,EAAKqC,gBAGH0C,KAAKgE,MAAMpD,YAAYlN,QAAQ+R,KAAK,SAAAnO,GAAC,OAAIA,EAAEtB,aAAa,aAAa0U,WAAWzP,KAAU3D,EAAEqT,2DAQrG,OAAO3K,KAAKyE,mDAOZ,OAAOzE,KAAKgH,yCAOZ,OAAOhH,KAAKgE,wCAUZ,OAHAhE,KAAKsG,OACLtG,KAAKtM,QAAQ+M,UAAW,EACxBT,KAAKgE,MAAMC,OAAOrE,UAAU8F,IAAI,YACzB1F,sCASP,OAFAA,KAAKtM,QAAQ+M,UAAW,EACxBT,KAAKgE,MAAMC,OAAOrE,UAAU0H,OAAO,YAC5BtH,0CAKfF,EAAM8K,MAAQ5M,EAGd8B,EAAMrN,OAAS,SAAAiB,GAAO,OAAI,IAAIoM,EAAMpM,IAGpCoM,EAAM+K,QAAU,QACD/K","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 = 0);\n","/**\r\n * Add event(s) to element(s).\r\n * @param elements DOM-Elements\r\n * @param events Event names\r\n * @param fn Callback\r\n * @param options Optional options\r\n * @return Array passed arguments\r\n */\r\nexport const on = eventListener.bind(null, 'addEventListener');\r\n\r\n/**\r\n * Remove event(s) from element(s).\r\n * @param elements DOM-Elements\r\n * @param events Event names\r\n * @param fn Callback\r\n * @param options Optional options\r\n * @return Array passed arguments\r\n */\r\nexport const off = eventListener.bind(null, 'removeEventListener');\r\n\r\nfunction eventListener(method, elements, events, fn, options = {}) {\r\n\r\n // Normalize array\r\n if (elements instanceof HTMLCollection || elements instanceof NodeList) {\r\n elements = Array.from(elements);\r\n } else if (!Array.isArray(elements)) {\r\n elements = [elements];\r\n }\r\n\r\n if (!Array.isArray(events)) {\r\n events = [events];\r\n }\r\n\r\n for (const el of elements) {\r\n for (const ev of events) {\r\n el[method](ev, fn, {capture: false, ...options});\r\n }\r\n }\r\n\r\n return Array.prototype.slice.call(arguments, 1);\r\n}\r\n\r\n/**\r\n * Creates an DOM-Element out of a string (Single element).\r\n * @param html HTML representing a single element\r\n * @returns {Element | null} The element.\r\n */\r\nexport function createElementFromString(html) {\r\n const div = document.createElement('div');\r\n div.innerHTML = html.trim();\r\n return div.firstElementChild;\r\n}\r\n\r\n/**\r\n * Removes an attribute from a HTMLElement and returns the value.\r\n * @param el\r\n * @param name\r\n * @return {string}\r\n */\r\nexport function removeAttribute(el, name) {\r\n const value = el.getAttribute(name);\r\n el.removeAttribute(name);\r\n return value;\r\n}\r\n\r\n/**\r\n * Creates a new html element, every element which has\r\n * a 'data-key' attribute will be saved in a object (which will be returned)\r\n * where the value of 'data-key' ist the object-key and the value the HTMLElement.\r\n *\r\n * It's possible to create a hierarchy if you add a 'data-con' attribute. Every\r\n * sibling will be added to the object which will get the name from the 'data-con' attribute.\r\n *\r\n * If you want to create an Array out of multiple elements, you can use the 'data-arr' attribute,\r\n * the value defines the key and all elements, which has the same parent and the same 'data-arr' attribute,\r\n * would be added to it.\r\n *\r\n * @param str - The HTML String.\r\n */\r\nexport function createFromTemplate(str) {\r\n\r\n // Recursive function to resolve template\r\n function resolve(element, base = {}) {\r\n\r\n // Check key and container attribute\r\n const con = removeAttribute(element, 'data-con');\r\n const key = removeAttribute(element, 'data-key');\r\n\r\n // Check and save element\r\n if (key) {\r\n base[key] = element;\r\n }\r\n\r\n // Check all children\r\n const subtree = con ? (base[con] = {}) : base;\r\n for (let child of Array.from(element.children)) {\r\n\r\n // Check if element should be saved as array\r\n const arr = removeAttribute(child, 'data-arr');\r\n if (arr) {\r\n\r\n // Check if there is already an array and add element\r\n (subtree[arr] || (subtree[arr] = [])).push(child);\r\n } else {\r\n resolve(child, subtree);\r\n }\r\n }\r\n\r\n return base;\r\n }\r\n\r\n return resolve(createElementFromString(str));\r\n}\r\n\r\n/**\r\n * Polyfill for safari & firefox for the eventPath event property.\r\n * @param evt The event object.\r\n * @return [String] event path.\r\n */\r\nexport function eventPath(evt) {\r\n let path = evt.path || (evt.composedPath && evt.composedPath());\r\n if (path) return path;\r\n\r\n let el = evt.target.parentElement;\r\n path = [evt.target, el];\r\n while (el = el.parentElement) path.push(el);\r\n\r\n path.push(document, window);\r\n return path;\r\n}\r\n\r\n/**\r\n * Creates the ability to change numbers in an input field with the scroll-wheel.\r\n * @param el\r\n * @param mapper\r\n */\r\nexport function adjustableInputNumbers(el, mapper = v => v) {\r\n\r\n function handleScroll(e) {\r\n const inc = ([0.001, 0.01, 0.1])[Number(e.shiftKey || e.ctrlKey * 2)] * (e.deltaY < 0 ? 1 : -1);\r\n\r\n let index = 0;\r\n let off = el.selectionStart;\r\n el.value = el.value.replace(/[\\d.]+/g, (v, i) => {\r\n\r\n // Check if number is in cursor range and increase it\r\n if (i <= off && i + v.length >= off) {\r\n off = i;\r\n return mapper(Number(v), inc, index);\r\n }\r\n\r\n index++;\r\n return v;\r\n });\r\n\r\n el.focus();\r\n el.setSelectionRange(off, off);\r\n\r\n // Prevent default and trigger input event\r\n e.preventDefault();\r\n el.dispatchEvent(new Event('input'));\r\n }\r\n\r\n // Bind events\r\n on(el, 'focus', () => on(window, 'wheel', handleScroll, {passive: false}));\r\n on(el, 'blur', () => off(window, 'wheel', handleScroll));\r\n}\r\n","// Shorthands\r\nconst {min, max, floor, round} = Math;\r\n\r\n/**\r\n * Tries to convert a color name to rgb/a hex representation\r\n * @param name\r\n * @returns {string | CanvasGradient | CanvasPattern}\r\n */\r\nfunction standardizeColor(name) {\r\n const ctx = document.createElement('canvas').getContext('2d');\r\n ctx.fillStyle = name;\r\n return ctx.fillStyle;\r\n}\r\n\r\n/**\r\n * Convert HSV spectrum to RGB.\r\n * @param h Hue\r\n * @param s Saturation\r\n * @param v Value\r\n * @returns {number[]} Array with rgb values.\r\n */\r\nexport function hsvToRgb(h, s, v) {\r\n h = (h / 360) * 6;\r\n s /= 100;\r\n v /= 100;\r\n\r\n let i = floor(h);\r\n\r\n let f = h - i;\r\n let p = v * (1 - s);\r\n let q = v * (1 - f * s);\r\n let t = v * (1 - (1 - f) * s);\r\n\r\n let mod = i % 6;\r\n let r = [v, q, p, p, t, v][mod];\r\n let g = [t, v, v, q, p, p][mod];\r\n let b = [p, p, t, v, v, q][mod];\r\n\r\n return [\r\n r * 255,\r\n g * 255,\r\n b * 255\r\n ];\r\n}\r\n\r\n/**\r\n * Convert HSV spectrum to Hex.\r\n * @param h Hue\r\n * @param s Saturation\r\n * @param v Value\r\n * @returns {string[]} Hex values\r\n */\r\nexport function hsvToHex(h, s, v) {\r\n return hsvToRgb(h, s, v).map(v =>\r\n round(v).toString(16).padStart(2, '0')\r\n );\r\n}\r\n\r\n/**\r\n * Convert HSV spectrum to CMYK.\r\n * @param h Hue\r\n * @param s Saturation\r\n * @param v Value\r\n * @returns {number[]} CMYK values\r\n */\r\nexport function hsvToCmyk(h, s, v) {\r\n const rgb = hsvToRgb(h, s, v);\r\n const r = rgb[0] / 255;\r\n const g = rgb[1] / 255;\r\n const b = rgb[2] / 255;\r\n\r\n let k, c, m, y;\r\n\r\n k = min(1 - r, 1 - g, 1 - b);\r\n\r\n c = k === 1 ? 0 : (1 - r - k) / (1 - k);\r\n m = k === 1 ? 0 : (1 - g - k) / (1 - k);\r\n y = k === 1 ? 0 : (1 - b - k) / (1 - k);\r\n\r\n return [\r\n c * 100,\r\n m * 100,\r\n y * 100,\r\n k * 100\r\n ];\r\n}\r\n\r\n/**\r\n * Convert HSV spectrum to HSL.\r\n * @param h Hue\r\n * @param s Saturation\r\n * @param v Value\r\n * @returns {number[]} HSL values\r\n */\r\nexport function hsvToHsl(h, s, v) {\r\n s /= 100, v /= 100;\r\n\r\n let l = (2 - s) * v / 2;\r\n\r\n if (l !== 0) {\r\n if (l === 1) {\r\n s = 0;\r\n } else if (l < 0.5) {\r\n s = s * v / (l * 2);\r\n } else {\r\n s = s * v / (2 - l * 2);\r\n }\r\n }\r\n\r\n return [\r\n h,\r\n s * 100,\r\n l * 100\r\n ];\r\n}\r\n\r\n/**\r\n * Convert RGB to HSV.\r\n * @param r Red\r\n * @param g Green\r\n * @param b Blue\r\n * @return {number[]} HSV values.\r\n */\r\nfunction rgbToHsv(r, g, b) {\r\n r /= 255, g /= 255, b /= 255;\r\n\r\n let h, s, v;\r\n const minVal = min(r, g, b);\r\n const maxVal = max(r, g, b);\r\n const delta = maxVal - minVal;\r\n\r\n v = maxVal;\r\n if (delta === 0) {\r\n h = s = 0;\r\n } else {\r\n s = delta / maxVal;\r\n let dr = (((maxVal - r) / 6) + (delta / 2)) / delta;\r\n let dg = (((maxVal - g) / 6) + (delta / 2)) / delta;\r\n let db = (((maxVal - b) / 6) + (delta / 2)) / delta;\r\n\r\n if (r === maxVal) {\r\n h = db - dg;\r\n } else if (g === maxVal) {\r\n h = (1 / 3) + dr - db;\r\n } else if (b === maxVal) {\r\n h = (2 / 3) + dg - dr;\r\n }\r\n\r\n if (h < 0) {\r\n h += 1;\r\n } else if (h > 1) {\r\n h -= 1;\r\n }\r\n }\r\n\r\n return [\r\n h * 360,\r\n s * 100,\r\n v * 100\r\n ];\r\n}\r\n\r\n/**\r\n * Convert CMYK to HSV.\r\n * @param c Cyan\r\n * @param m Magenta\r\n * @param y Yellow\r\n * @param k Key (Black)\r\n * @return {number[]} HSV values.\r\n */\r\nfunction cmykToHsv(c, m, y, k) {\r\n c /= 100, m /= 100, y /= 100, k /= 100;\r\n\r\n const r = (1 - min(1, c * (1 - k) + k)) * 255;\r\n const g = (1 - min(1, m * (1 - k) + k)) * 255;\r\n const b = (1 - min(1, y * (1 - k) + k)) * 255;\r\n\r\n return [...rgbToHsv(r, g, b)];\r\n}\r\n\r\n/**\r\n * Convert HSL to HSV.\r\n * @param h Hue\r\n * @param s Saturation\r\n * @param l Lightness\r\n * @return {number[]} HSV values.\r\n */\r\nfunction hslToHsv(h, s, l) {\r\n s /= 100, l /= 100;\r\n s *= l < 0.5 ? l : 1 - l;\r\n\r\n let ns = (2 * s / (l + s)) * 100;\r\n let v = (l + s) * 100;\r\n return [h, ns, v];\r\n}\r\n\r\n/**\r\n * Convert HEX to HSV.\r\n * @param hex Hexadecimal string of rgb colors, can have length 3 or 6.\r\n * @return {number[]} HSV values.\r\n */\r\nfunction hexToHsv(hex) {\r\n return rgbToHsv(...hex.match(/.{2}/g).map(v => parseInt(v, 16)));\r\n}\r\n\r\n/**\r\n * Try's to parse a string which represents a color to a HSV array.\r\n * Current supported types are cmyk, rgba, hsla and hexadecimal.\r\n * @param str\r\n * @return {*}\r\n */\r\nexport function parseToHSV(str) {\r\n\r\n // Check if string is a color-name\r\n str = str.match(/^[a-zA-Z]+$/) ? standardizeColor(str) : str;\r\n\r\n // Regular expressions to match different types of color represention\r\n const regex = {\r\n cmyk: /^cmyk[\\D]+(\\d+)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]+(\\d+)/i,\r\n rgba: /^(rgb|rgba)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]*?([\\d.]+|$)/i,\r\n hsla: /^(hsl|hsla)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]*?([\\d.]+|$)/i,\r\n hsva: /^(hsv|hsva)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]*?([\\d.]+|$)/i,\r\n hex: /^#?(([\\dA-Fa-f]{3,4})|([\\dA-Fa-f]{6})|([\\dA-Fa-f]{8}))$/i\r\n };\r\n\r\n /**\r\n * Takes an Array of any type, convert strings which represents\r\n * a number to a number an anything else to undefined.\r\n * @param array\r\n * @return {*}\r\n */\r\n const numarize = array => array.map(v => /^(|\\d+)\\.\\d+|\\d+$/.test(v) ? Number(v) : undefined);\r\n\r\n let match;\r\n for (const type in regex) {\r\n\r\n // Check if current scheme passed\r\n if (!(match = regex[type].exec(str)))\r\n continue;\r\n\r\n // Try to convert\r\n switch (type) {\r\n case 'cmyk': {\r\n let [, c, m, y, k] = numarize(match);\r\n\r\n if (c > 100 || m > 100 || y > 100 || k > 100)\r\n break;\r\n\r\n return {values: [...cmykToHsv(c, m, y, k), 1], type};\r\n }\r\n case 'rgba': {\r\n let [, , r, g, b, a = 1] = numarize(match);\r\n\r\n if (r > 255 || g > 255 || b > 255 || a < 0 || a > 1)\r\n break;\r\n\r\n return {values: [...rgbToHsv(r, g, b), a], type};\r\n }\r\n case 'hex': {\r\n const splitAt = (s, i) => [s.substring(0, i), s.substring(i, s.length)];\r\n let [, hex] = match;\r\n\r\n // Fill up opacity if not declared\r\n if (hex.length === 3) {\r\n hex += 'F';\r\n } else if (hex.length === 6) {\r\n hex += 'FF';\r\n }\r\n\r\n let alpha;\r\n if (hex.length === 4) {\r\n [hex, alpha] = splitAt(hex, 3).map(v => v + v);\r\n } else if (hex.length === 8) {\r\n [hex, alpha] = splitAt(hex, 6);\r\n }\r\n\r\n // Convert 0 - 255 to 0 - 1 for opacity\r\n alpha = parseInt(alpha, 16) / 255;\r\n return {values: [...hexToHsv(hex), alpha], type};\r\n }\r\n case 'hsla': {\r\n let [, , h, s, l, a = 1] = numarize(match);\r\n\r\n if (h > 360 || s > 100 || l > 100 || a < 0 || a > 1)\r\n break;\r\n\r\n return {values: [...hslToHsv(h, s, l), a], type};\r\n }\r\n case 'hsva': {\r\n let [, , h, s, v, a = 1] = numarize(match);\r\n\r\n if (h > 360 || s > 100 || v > 100 || a < 0 || a > 1)\r\n break;\r\n\r\n return {values: [h, s, v, a], type};\r\n }\r\n }\r\n }\r\n\r\n return {values: null, type: null};\r\n}\r\n","import {hsvToHsl, hsvToRgb, hsvToCmyk, hsvToHex} from './color';\r\n\r\n/**\r\n * Simple class which holds the properties\r\n * of the color represention model hsla (hue saturation lightness alpha)\r\n */\r\nexport function HSVaColor(h = 0, s = 0, v = 0, a = 1) {\r\n const {ceil} = Math;\r\n\r\n const that = {\r\n h, s, v, a,\r\n\r\n toHSVA() {\r\n const hsva = [that.h, that.s, that.v];\r\n const rhsva = hsva.map(ceil);\r\n\r\n hsva.push(that.a);\r\n hsva.toString = () => `hsva(${rhsva[0]}, ${rhsva[1]}%, ${rhsva[2]}%, ${that.a.toFixed(1)})`;\r\n return hsva;\r\n },\r\n\r\n toHSLA() {\r\n const hsla = hsvToHsl(that.h, that.s, that.v);\r\n const rhsla = hsla.map(ceil);\r\n\r\n hsla.push(that.a);\r\n hsla.toString = () => `hsla(${rhsla[0]}, ${rhsla[1]}%, ${rhsla[2]}%, ${that.a.toFixed(1)})`;\r\n return hsla;\r\n },\r\n\r\n toRGBA() {\r\n const rgba = hsvToRgb(that.h, that.s, that.v);\r\n const rrgba = rgba.map(ceil);\r\n\r\n rgba.push(that.a);\r\n rgba.toString = () => `rgba(${rrgba[0]}, ${rrgba[1]}, ${rrgba[2]}, ${that.a.toFixed(1)})`;\r\n return rgba;\r\n },\r\n\r\n toCMYK() {\r\n const cmyk = hsvToCmyk(that.h, that.s, that.v);\r\n const rcmyk = cmyk.map(ceil);\r\n\r\n cmyk.toString = () => `cmyk(${rcmyk[0]}%, ${rcmyk[1]}%, ${rcmyk[2]}%, ${rcmyk[3]}%)`;\r\n return cmyk;\r\n },\r\n\r\n toHEXA() {\r\n const hex = hsvToHex(that.h, that.s, that.v);\r\n\r\n hex.toString = () => {\r\n\r\n // Check if alpha channel make sense, convert it to 255 number space, convert\r\n // to hex and pad it with zeros if needet.\r\n const alpha = that.a >= 1 ? '' : Number((that.a * 255).toFixed(0))\r\n .toString(16)\r\n .toUpperCase().padStart(2, '0');\r\n\r\n return `#${hex.join('').toUpperCase() + alpha}`;\r\n };\r\n\r\n return hex;\r\n },\r\n\r\n clone() {\r\n return HSVaColor(that.h, that.s, that.v, that.a);\r\n }\r\n };\r\n\r\n return that;\r\n}\r\n","import * as _ from '../utils/utils';\r\n\r\nconst clamp = v => Math.max(Math.min(v, 1), 0);\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 lock: null,\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: {lock}, cache} = that;\r\n const {element, wrapper} = options;\r\n const b = 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 (lock !== 'h') {\r\n element.style.left = `calc(${x / b.width * 100}% - ${element.offsetWidth / 2}px)`;\r\n }\r\n\r\n if (lock !== 'v') {\r\n element.style.top = `calc(${y / b.height * 100}% - ${element.offsetHeight / 2}px)`;\r\n }\r\n\r\n that.cache = {x: x / b.width, y: y / b.height};\r\n const cx = clamp(x / wrapper.offsetWidth);\r\n const cy = clamp(y / wrapper.offsetHeight);\r\n\r\n switch (lock) {\r\n case 'v':\r\n return options.onchange(cx);\r\n case 'h':\r\n return options.onchange(cy);\r\n default:\r\n return options.onchange(cx, cy);\r\n }\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 {left, top, width, height} = that.options.wrapper.getBoundingClientRect();\r\n that._tapmove({\r\n clientX: left + width * x,\r\n clientY: top + height * 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 '../utils/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","\r\n// Import utils\r\nimport * as _ from './utils/utils';\r\nimport * as Color from './utils/color';\r\n\r\n// Import classes\r\nimport {HSVaColor} from './utils/hsvacolor';\r\nimport Moveable from './libs/moveable';\r\nimport Selectable from './libs/selectable';\r\nimport Nanopop from './libs/nanopop';\r\nimport buildPickr from './template';\r\n\r\nclass Pickr {\r\n\r\n // Will be used to prevent specific actions during initilization\r\n _initializingActive = true;\r\n\r\n // Replace element with color picker\r\n _recalc = true;\r\n\r\n // Current and last color for comparison\r\n _color = HSVaColor();\r\n _lastColor = HSVaColor();\r\n _swatchColors = [];\r\n\r\n // Evenlistener name: [callbacks]\r\n _eventListener = {\r\n 'swatchselect': [],\r\n 'change': [],\r\n 'save': [],\r\n 'init': []\r\n };\r\n\r\n constructor(opt) {\r\n\r\n // Assign default values\r\n this.options = opt = Object.assign({\r\n appClass: null,\r\n useAsButton: false,\r\n disabled: false,\r\n comparison: true,\r\n\r\n components: {\r\n interaction: {}\r\n },\r\n\r\n strings: {},\r\n swatches: null,\r\n inline: false,\r\n sliders: 'v',\r\n\r\n default: '#42445A',\r\n defaultRepresentation: null,\r\n position: 'bottom-middle',\r\n adjustableNumbers: true,\r\n showAlways: false,\r\n\r\n closeWithKey: 'Escape'\r\n }, opt);\r\n\r\n const {swatches, inline, components, position} = opt;\r\n\r\n // Check interaction section\r\n if (!components.interaction) {\r\n components.interaction = {};\r\n }\r\n\r\n // Overwrite palette if preview, opacity or hue are true\r\n const {preview, opacity, hue, palette} = components;\r\n components.palette = palette || preview || opacity || hue;\r\n\r\n // Per default enabled if inline\r\n if (inline) {\r\n opt.showAlways = true;\r\n }\r\n\r\n // Initialize picker\r\n this._preBuild();\r\n this._buildComponents();\r\n this._bindEvents();\r\n\r\n // Finalize build\r\n this._finalBuild();\r\n\r\n // Append pre-defined swatch colors\r\n if (swatches && swatches.length) {\r\n swatches.forEach(color => this.addSwatch(color));\r\n }\r\n\r\n // Initialize positioning engine\r\n this._nanopop = Nanopop({\r\n reference: this._root.button,\r\n el: this._root.app,\r\n pos: position\r\n });\r\n\r\n // Initilization is finish, pickr is visible and ready for usage\r\n const {button} = this._root;\r\n const that = this;\r\n requestAnimationFrame((function cb() {\r\n\r\n // offsetParent of body is always 0. So check if it is the body\r\n if (button.offsetParent === null && button !== document.body) {\r\n return requestAnimationFrame(cb);\r\n }\r\n\r\n // Apply default color\r\n that.setColor(opt.default);\r\n that._rePositioningPicker();\r\n\r\n // Initialize color representation\r\n if (opt.defaultRepresentation) {\r\n that._representation = opt.defaultRepresentation;\r\n that.setColorRepresentation(that._representation);\r\n }\r\n\r\n // Show pickr if locked\r\n if (opt.showAlways) {\r\n that.show();\r\n }\r\n\r\n // Initialization is done - pickr is usable, fire init event\r\n that._initializingActive = false;\r\n that._emit('init');\r\n }));\r\n }\r\n\r\n // Does only the absolutly basic thing to initialize the components\r\n _preBuild() {\r\n const opt = this.options;\r\n\r\n // Check if element is selector\r\n if (typeof opt.el === 'string') {\r\n\r\n // Resolve possible shadow dom access\r\n opt.el = opt.el.split(/>>/g).reduce((pv, cv, ci, a) => {\r\n pv = pv.querySelector(cv);\r\n return ci < a.length - 1 ? pv.shadowRoot : pv;\r\n }, document);\r\n }\r\n\r\n // Create element and append it to body to\r\n // prevent initialization errors\r\n this._root = buildPickr(opt);\r\n\r\n // Check if a custom button is used\r\n if (opt.useAsButton) {\r\n this._root.button = opt.el; // Replace button with customized button\r\n }\r\n\r\n document.body.appendChild(this._root.root);\r\n }\r\n\r\n _finalBuild() {\r\n const opt = this.options;\r\n const root = this._root;\r\n\r\n // Remove from body\r\n document.body.removeChild(root.root);\r\n\r\n if (opt.inline) {\r\n const {parentElement} = opt.el;\r\n\r\n if (parentElement.lastChild === opt.el) {\r\n parentElement.appendChild(root.app);\r\n } else {\r\n parentElement.insertBefore(root.app, opt.el.nextSibling);\r\n }\r\n } else {\r\n document.body.appendChild(root.app);\r\n }\r\n\r\n // Don't replace the the element if a custom button is used\r\n if (!opt.useAsButton) {\r\n\r\n // Replace element with actual color-picker\r\n opt.el.parentNode.replaceChild(root.root, opt.el);\r\n }\r\n\r\n // Call disable to also add the disabled class\r\n if (opt.disabled) {\r\n this.disable();\r\n }\r\n\r\n // Check if color comparison is disabled, if yes - remove transitions so everything keeps smoothly\r\n if (!opt.comparison) {\r\n root.button.style.transition = 'none';\r\n if (!opt.useAsButton) {\r\n root.preview.lastColor.style.transition = 'none';\r\n }\r\n }\r\n\r\n this.hide();\r\n }\r\n\r\n _buildComponents() {\r\n\r\n // Instance reference\r\n const inst = this;\r\n const comp = this.options.components;\r\n const [so, sh] = (() => {\r\n const {sliders} = inst.options;\r\n let so = 'v', sh = 'v';\r\n\r\n if (sliders.match(/^[vh]+$/g)) {\r\n if (sliders.length > 1) {\r\n [so, sh] = sliders;\r\n } else {\r\n so = sh = sliders;\r\n }\r\n }\r\n\r\n const opposite = {v: 'h', h: 'v'};\r\n return [opposite[so], opposite[sh]];\r\n })();\r\n\r\n const components = {\r\n\r\n palette: Moveable({\r\n element: inst._root.palette.picker,\r\n wrapper: inst._root.palette.palette,\r\n\r\n onchange(x, y) {\r\n if (!comp.palette) return;\r\n const {_color, _root, options} = inst;\r\n\r\n // Calculate saturation based on the position\r\n _color.s = x * 100;\r\n\r\n // Calculate the value\r\n _color.v = 100 - y * 100;\r\n\r\n // Prevent falling under zero\r\n _color.v < 0 ? _color.v = 0 : 0;\r\n\r\n // Set picker and gradient color\r\n const cssRGBaString = _color.toRGBA().toString();\r\n this.element.style.background = cssRGBaString;\r\n this.wrapper.style.background = `\r\n linear-gradient(to top, rgba(0, 0, 0, ${_color.a}), transparent),\r\n linear-gradient(to left, hsla(${_color.h}, 100%, 50%, ${_color.a}), rgba(255, 255, 255, ${_color.a}))\r\n `;\r\n\r\n // Check if color is locked\r\n if (!options.comparison) {\r\n _root.button.style.color = cssRGBaString;\r\n\r\n if (!options.useAsButton) {\r\n _root.preview.lastColor.style.color = cssRGBaString;\r\n }\r\n }\r\n\r\n // Change current color\r\n _root.preview.currentColor.style.color = cssRGBaString;\r\n\r\n // Update the input field only if the user is currently not typing\r\n if (inst._recalc) {\r\n inst._updateOutput();\r\n }\r\n\r\n if (!inst.options.comparison) {\r\n\r\n // If the user changes the color, remove the cleared icon\r\n _root.button.classList.remove('clear');\r\n }\r\n }\r\n }),\r\n\r\n hue: Moveable({\r\n lock: sh,\r\n element: inst._root.hue.picker,\r\n wrapper: inst._root.hue.slider,\r\n\r\n onchange(v) {\r\n if (!comp.hue || !comp.palette) return;\r\n\r\n // Calculate hue\r\n inst._color.h = v * 360;\r\n\r\n // Update color\r\n this.element.style.backgroundColor = `hsl(${inst._color.h}, 100%, 50%)`;\r\n components.palette.trigger();\r\n }\r\n }),\r\n\r\n opacity: Moveable({\r\n lock: so,\r\n element: inst._root.opacity.picker,\r\n wrapper: inst._root.opacity.slider,\r\n\r\n onchange(v) {\r\n if (!comp.opacity || !comp.palette) return;\r\n\r\n // Calculate opacity\r\n inst._color.a = Math.round(v * 1e2) / 100;\r\n\r\n // Update color\r\n this.element.style.background = `rgba(0, 0, 0, ${inst._color.a})`;\r\n inst.components.palette.trigger();\r\n }\r\n }),\r\n\r\n selectable: Selectable({\r\n elements: inst._root.interaction.options,\r\n className: 'active',\r\n onchange(e) {\r\n inst._representation = e.target.getAttribute('data-type').toUpperCase();\r\n inst._updateOutput();\r\n }\r\n })\r\n };\r\n\r\n this.components = components;\r\n }\r\n\r\n _bindEvents() {\r\n const {_root, options} = this;\r\n\r\n const eventBindings = [\r\n\r\n // Clear color\r\n _.on(_root.interaction.clear, 'click', () => this._clearColor()),\r\n\r\n // Select last color on click\r\n _.on(_root.preview.lastColor, 'click', () => this.setHSVA(...this._lastColor.toHSVA())),\r\n\r\n // Save color\r\n _.on(_root.interaction.save, 'click', () => {\r\n !this.applyColor() && !options.showAlways && this.hide();\r\n }),\r\n\r\n // Detect user input and disable auto-recalculation\r\n _.on(_root.interaction.result, ['keyup', 'input'], e => {\r\n this._recalc = false;\r\n\r\n // Fire listener if initialization is finish and changed color was valid\r\n if (this.setColor(e.target.value, true) && !this._initializingActive) {\r\n this._emit('change', this._color);\r\n }\r\n\r\n e.stopImmediatePropagation();\r\n }),\r\n\r\n // Cancel input detection on color change\r\n _.on([\r\n _root.palette.palette,\r\n _root.palette.picker,\r\n _root.hue.slider,\r\n _root.hue.picker,\r\n _root.opacity.slider,\r\n _root.opacity.picker\r\n ], ['mousedown', 'touchstart'], () => this._recalc = true)\r\n ];\r\n\r\n // Provide hiding / showing abilities only if showAlways is false\r\n if (!options.showAlways) {\r\n const ck = options.closeWithKey;\r\n\r\n eventBindings.push(\r\n // Save and hide / show picker\r\n _.on(_root.button, 'click', () => this.isOpen() ? this.hide() : this.show()),\r\n\r\n // Close with escape key\r\n _.on(document, 'keyup', e => this.isOpen() && (e.key === ck || e.code === ck) && this.hide()),\r\n\r\n // Cancel selecting if the user taps behind the color picker\r\n _.on(document, ['touchstart', 'mousedown'], e => {\r\n if (this.isOpen() && !_.eventPath(e).some(el => el === _root.app || el === _root.button)) {\r\n this.hide();\r\n }\r\n }, {capture: true})\r\n );\r\n }\r\n\r\n // Make input adjustable if enabled\r\n if (options.adjustableNumbers) {\r\n const ranges = {\r\n rgba: [255, 255, 255, 1],\r\n hsva: [360, 100, 100, 1],\r\n hsla: [360, 100, 100, 1],\r\n cmyk: [100, 100, 100, 100]\r\n };\r\n\r\n _.adjustableInputNumbers(_root.interaction.result, (o, step, index) => {\r\n const range = ranges[this.getColorRepresentation().toLowerCase()];\r\n\r\n if (range) {\r\n const max = range[index];\r\n\r\n // Calculate next reasonable number\r\n const nv = o + (max >= 100 ? step * 1000 : step);\r\n\r\n // Apply range of zero up to max, fix floating-point issues\r\n return nv <= 0 ? 0 : Number((nv < max ? nv : max).toPrecision(3));\r\n } else {\r\n return o;\r\n }\r\n });\r\n }\r\n\r\n if (!options.inline) {\r\n let timeout = null;\r\n const that = this;\r\n\r\n // Re-calc position on window resize, scroll and wheel\r\n eventBindings.push(\r\n _.on(window, ['scroll', 'resize'], () => {\r\n if (that.isOpen()) {\r\n if (timeout === null) {\r\n timeout = setTimeout(() => timeout = null, 100);\r\n\r\n // Update position on every frame\r\n requestAnimationFrame(function rs() {\r\n that._rePositioningPicker();\r\n (timeout !== null) && requestAnimationFrame(rs);\r\n });\r\n } else {\r\n clearTimeout(timeout);\r\n timeout = setTimeout(() => timeout = null, 100);\r\n }\r\n }\r\n })\r\n );\r\n }\r\n\r\n // Save bindings\r\n this._eventBindings = eventBindings;\r\n }\r\n\r\n _rePositioningPicker() {\r\n\r\n // No repositioning needed if inline\r\n if (!this.options.inline) {\r\n this._nanopop.update();\r\n }\r\n }\r\n\r\n _updateOutput() {\r\n\r\n // Check if component is present\r\n if (this._root.interaction.type()) {\r\n\r\n // Construct function name and call if present\r\n const method = `to${this._root.interaction.type().getAttribute('data-type')}`;\r\n this._root.interaction.result.value = typeof this._color[method] === 'function' ? this._color[method]().toString() : '';\r\n }\r\n\r\n // Fire listener if initialization is finish\r\n if (!this._initializingActive) {\r\n this._emit('change', this._color);\r\n }\r\n }\r\n\r\n _clearColor() {\r\n const {_root, options} = this;\r\n\r\n // Change only the button color if it isn't customized\r\n if (!options.useAsButton) {\r\n _root.button.style.color = 'rgba(0, 0, 0, 0.15)';\r\n }\r\n\r\n _root.button.classList.add('clear');\r\n\r\n if (!options.showAlways) {\r\n this.hide();\r\n }\r\n\r\n if (!this._initializingActive) {\r\n\r\n // Fire listener\r\n this._emit('save', null);\r\n }\r\n }\r\n\r\n _emit(event, ...args) {\r\n this._eventListener[event].forEach(cb => cb(...args, this));\r\n }\r\n\r\n on(event, cb) {\r\n\r\n // Validate\r\n if (typeof cb === 'function' && typeof event === 'string' && event in this._eventListener) {\r\n this._eventListener[event].push(cb);\r\n }\r\n\r\n return this;\r\n }\r\n\r\n off(event, cb) {\r\n const callBacks = this._eventListener[event];\r\n\r\n if (callBacks) {\r\n const index = callBacks.indexOf(cb);\r\n\r\n if (~index) {\r\n callBacks.splice(index, 1);\r\n }\r\n }\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Appends a color to the swatch palette\r\n * @param color\r\n * @returns {boolean}\r\n */\r\n addSwatch(color) {\r\n const {values} = Color.parseToHSV(color);\r\n\r\n if (values) {\r\n const {_swatchColors, _root} = this;\r\n const hsvaColorObject = HSVaColor(...values);\r\n\r\n // Create new swatch HTMLElement\r\n const element = _.createElementFromString(\r\n ``\r\n );\r\n\r\n // Append element and save swatch data\r\n _root.swatches.appendChild(element);\r\n _swatchColors.push({element, hsvaColorObject});\r\n\r\n // Bind event\r\n this._eventBindings.push(\r\n _.on(element, 'click', () => {\r\n this.setHSVA(...hsvaColorObject.toHSVA(), true);\r\n this._emit('swatchselect', hsvaColorObject);\r\n })\r\n );\r\n\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n /**\r\n * Removes a swatch color by it's index\r\n * @param index\r\n * @returns {boolean}\r\n */\r\n removeSwatch(index) {\r\n\r\n // Validate index\r\n if (typeof index === 'number') {\r\n const swatchColor = this._swatchColors[index];\r\n\r\n // Check swatch data\r\n if (swatchColor) {\r\n const {element} = swatchColor;\r\n\r\n // Remove HTML child and swatch data\r\n this._root.swatches.removeChild(element);\r\n this._swatchColors.splice(index, 1);\r\n return true;\r\n }\r\n }\r\n\r\n return false;\r\n }\r\n\r\n applyColor(silent = false) {\r\n const {preview, button} = this._root;\r\n\r\n // Change preview and current color\r\n const cssRGBaString = this._color.toRGBA().toString();\r\n preview.lastColor.style.color = cssRGBaString;\r\n\r\n // Change only the button color if it isn't customized\r\n if (!this.options.useAsButton) {\r\n button.style.color = cssRGBaString;\r\n }\r\n\r\n // User changed the color so remove the clear clas\r\n button.classList.remove('clear');\r\n\r\n // Save last color\r\n this._lastColor = this._color.clone();\r\n\r\n // Fire listener\r\n if (!this._initializingActive && !silent) {\r\n this._emit('save', this._color);\r\n }\r\n }\r\n\r\n /**\r\n * Destroy's all functionalitys\r\n */\r\n destroy() {\r\n this._eventBindings.forEach(args => _.off(...args));\r\n Object.keys(this.components).forEach(key => this.components[key].destroy());\r\n }\r\n\r\n /**\r\n * Destroy's all functionalitys and removes\r\n * the pickr element.\r\n */\r\n destroyAndRemove() {\r\n this.destroy();\r\n\r\n // Remove element\r\n const root = this._root.root;\r\n root.parentElement.removeChild(root);\r\n\r\n // remove .pcr-app\r\n const app = this._root.app;\r\n app.parentElement.removeChild(app);\r\n\r\n // There are references to various DOM elements stored in the pickr instance\r\n // This cleans all of them to avoid detached DOMs\r\n const pickr = this;\r\n Object.keys(pickr).forEach(key => pickr[key] = null);\r\n }\r\n\r\n /**\r\n * Hides the color-picker ui.\r\n */\r\n hide() {\r\n this._root.app.classList.remove('visible');\r\n return this;\r\n }\r\n\r\n /**\r\n * Shows the color-picker ui.\r\n */\r\n show() {\r\n if (this.options.disabled) return;\r\n this._root.app.classList.add('visible');\r\n this._rePositioningPicker();\r\n return this;\r\n }\r\n\r\n /**\r\n * @return {boolean} If the color picker is currently open\r\n */\r\n isOpen() {\r\n return this._root.app.classList.contains('visible');\r\n }\r\n\r\n /**\r\n * Set a specific color.\r\n * @param h Hue\r\n * @param s Saturation\r\n * @param v Value\r\n * @param a Alpha channel (0 - 1)\r\n * @param silent If the button should not change the color\r\n * @return boolean if the color has been accepted\r\n */\r\n setHSVA(h = 360, s = 0, v = 0, a = 1, silent = false) {\r\n\r\n // Deactivate color calculation\r\n const recalc = this._recalc; // Save state\r\n this._recalc = false;\r\n\r\n // Validate input\r\n if (h < 0 || h > 360 || s < 0 || s > 100 || v < 0 || v > 100 || a < 0 || a > 1) {\r\n return false;\r\n }\r\n\r\n // Override current color and re-active color calculation\r\n this._color = HSVaColor(h, s, v, a);\r\n\r\n // Update slider and palette\r\n const {hue, opacity, palette} = this.components;\r\n hue.update(0, (h / 360));\r\n opacity.update(0, a);\r\n palette.update(s / 100, 1 - (v / 100));\r\n\r\n // Restore old state\r\n this._recalc = recalc;\r\n\r\n // Update output if recalculation is enabled\r\n if (this._recalc) {\r\n this._updateOutput();\r\n }\r\n\r\n // Check if call is silent\r\n if (!silent) {\r\n this.applyColor();\r\n }\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * Tries to parse a string which represents a color.\r\n * Examples: #fff\r\n * rgb 10 10 200\r\n * hsva 10 20 5 0.5\r\n * @param string\r\n * @param silent\r\n */\r\n setColor(string, silent = false) {\r\n\r\n // Check if null\r\n if (string === null) {\r\n this._clearColor();\r\n return true;\r\n }\r\n\r\n const {values, type} = Color.parseToHSV(string);\r\n\r\n // Check if color is ok\r\n if (values) {\r\n\r\n // Change selected color format\r\n const utype = type.toUpperCase();\r\n const {options} = this._root.interaction;\r\n const target = options.find(el => el.getAttribute('data-type').startsWith(utype));\r\n\r\n // Auto select only if not hidden\r\n if (target && !target.hidden) {\r\n for (const el of options) {\r\n el.classList[el === target ? 'add' : 'remove']('active');\r\n }\r\n }\r\n\r\n return this.setHSVA(...values, silent);\r\n }\r\n }\r\n\r\n /**\r\n * Changes the color _representation.\r\n * Allowed values are HEX, RGB, HSV, HSL and CMYK\r\n * @param type\r\n * @returns {boolean} if the selected type was valid.\r\n */\r\n setColorRepresentation(type) {\r\n\r\n // Force uppercase to allow a case-sensitiv comparison\r\n type = type.toUpperCase();\r\n\r\n // Find button with given type and trigger click event\r\n return !!this._root.interaction.options.find(v => v.getAttribute('data-type').startsWith(type) && !v.click());\r\n }\r\n\r\n /**\r\n * Returns the current color representaion. See setColorRepresentation\r\n * @returns {*}\r\n */\r\n getColorRepresentation() {\r\n return this._representation;\r\n }\r\n\r\n /**\r\n * @returns HSVaColor Current HSVaColor object.\r\n */\r\n getColor() {\r\n return this._color;\r\n }\r\n\r\n /**\r\n * @returns The root HTMLElement with all his components.\r\n */\r\n getRoot() {\r\n return this._root;\r\n }\r\n\r\n /**\r\n * Disable pickr\r\n */\r\n disable() {\r\n this.hide();\r\n this.options.disabled = true;\r\n this._root.button.classList.add('disabled');\r\n return this;\r\n }\r\n\r\n /**\r\n * Enable pickr\r\n */\r\n enable() {\r\n this.options.disabled = false;\r\n this._root.button.classList.remove('disabled');\r\n return this;\r\n }\r\n}\r\n\r\n// Expose pickr utils\r\nPickr.utils = _;\r\n\r\n// Create instance via method\r\nPickr.create = options => new Pickr(options);\r\n\r\n// Assign version and export\r\nPickr.version = '0.6.4';\r\nexport default Pickr;\r\n","/**\r\n * Micro positioning-engine\r\n * @param el\r\n * @param reference\r\n * @param pos\r\n * @param padding\r\n * @returns {{update(): void}}\r\n * @constructor\r\n */\r\nexport default function Nanopop({el, reference, pos, padding = 8}) {\r\n const vBehaviour = {start: 'sme', middle: 'mse', end: 'ems'};\r\n const hBehaviour = {top: 'tb', right: 'rl', bottom: 'bt', left: 'lr'};\r\n const [position, variant = 'middle'] = pos.split('-');\r\n const isVertical = (position === 'top' || position === 'bottom');\r\n\r\n return {\r\n update() {\r\n const rb = reference.getBoundingClientRect();\r\n const eb = el.getBoundingClientRect();\r\n\r\n const positions = isVertical ? {\r\n t: rb.top - eb.height - padding,\r\n b: rb.bottom + padding\r\n } : {\r\n r: rb.right + padding,\r\n l: rb.left - eb.width - padding\r\n };\r\n\r\n const variants = isVertical ? {\r\n s: rb.left + rb.width - eb.width,\r\n m: (-eb.width / 2) + (rb.left + rb.width / 2),\r\n e: rb.left\r\n } : {\r\n s: rb.bottom - eb.height,\r\n m: rb.bottom - rb.height / 2 - eb.height / 2,\r\n e: rb.bottom - rb.height\r\n };\r\n\r\n function apply(bevs, vars, styleprop) {\r\n const vertical = styleprop === 'top';\r\n const adder = vertical ? eb.height : eb.width;\r\n const win = window[vertical ? 'innerHeight' : 'innerWidth'];\r\n\r\n for (const ch of bevs) {\r\n const v = vars[ch];\r\n if (v > 0 && (v + adder) < win) {\r\n el.style[styleprop] = `${v}px`;\r\n break;\r\n }\r\n }\r\n }\r\n\r\n apply(vBehaviour[variant], variants, isVertical ? 'left' : 'top');\r\n apply(hBehaviour[position], positions, isVertical ? 'top' : 'left');\r\n }\r\n };\r\n}\r\n","import * as _ from './utils/utils';\r\n\r\nexport default ({components: c, strings: s, useAsButton, inline, appClass}) => {\r\n const hidden = con => con ? '' : 'style=\"display:none\" hidden';\r\n\r\n const root = _.createFromTemplate(`\r\n
\r\n\r\n ${useAsButton ? '' : ''}\r\n\r\n
\r\n
\r\n
\r\n \r\n
\r\n
\r\n\r\n
\r\n
\r\n
\r\n
\r\n\r\n
\r\n
\r\n
\r\n
\r\n\r\n
\r\n
\r\n
\r\n
\r\n
\r\n\r\n
\r\n\r\n
\r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n
\r\n
\r\n
\r\n `);\r\n\r\n const int = root.interaction;\r\n\r\n // Select option which is not hidden\r\n int.options.find(o => !o.hidden && !o.classList.add('active'));\r\n\r\n // Create method to find currenlty active option\r\n int.type = () => int.options.find(e => e.classList.contains('active'));\r\n return root;\r\n}\r\n"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap","webpack:///./src/js/utils/utils.js","webpack:///./src/js/utils/color.js","webpack:///./src/js/utils/hsvacolor.js","webpack:///./src/js/libs/moveable.js","webpack:///./src/js/libs/selectable.js","webpack:///./src/js/pickr.js","webpack:///./src/js/libs/nanopop.js","webpack:///./src/js/template.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","_iteratorNormalCompletion","_didIteratorError","_iteratorError","_step","_iterator","iterator","next","done","el","_iteratorNormalCompletion2","_didIteratorError2","_iteratorError2","_step2","_iterator2","ev","_objectSpread","capture","err","return","slice","createElementFromString","html","div","document","createElement","innerHTML","trim","firstElementChild","removeAttribute","getAttribute","createFromTemplate","str","resolve","element","base","con","subtree","_i","_Array$from","children","child","arr","push","eventPath","evt","path","composedPath","target","parentElement","adjustableInputNumbers","mapper","v","handleScroll","e","inc","Number","shiftKey","ctrlKey","deltaY","index","selectionStart","replace","focus","setSelectionRange","preventDefault","dispatchEvent","Event","passive","min","Math","max","floor","round","hsvToRgb","h","f","q","mod","rgbToHsv","g","b","minVal","maxVal","delta","dr","dg","db","cmykToHsv","y","k","_toConsumableArray","hslToHsv","hexToHsv","hex","apply","match","map","parseInt","parseToHSV","ctx","getContext","fillStyle","regex","cmyk","rgba","hsla","hsva","numarize","array","test","type","exec","_numarize2","_slicedToArray","values","concat","_numarize4","_numarize4$","a","splitAt","substring","alpha","_splitAt$map2","_splitAt2","_numarize6","_numarize6$","_numarize8","_numarize8$","HSVaColor","ceil","that","toHSVA","rhsva","toString","toFixed","toHSLA","hsvToHsl","rhsla","toRGBA","rrgba","toCMYK","rgb","hsvToCmyk","rcmyk","toHEXA","padStart","hsvToHex","toUpperCase","join","clone","clamp","Moveable","opt","assign","lock","onchange","_tapstart","_","_tapstop","_tapmove","cache","wrapper","getBoundingClientRect","x","touch","touches","clientX","clientY","left","width","top","height","style","offsetWidth","offsetHeight","cx","cy","trigger","update","_that$options$wrapper","destroy","Selectable","className","onTap","forEach","classList","selectable_toConsumableArray","Pickr","_this","this","_classCallCheck","pickr_defineProperty","swatchselect","change","save","init","appClass","useAsButton","disabled","comparison","components","interaction","strings","swatches","inline","sliders","default","defaultRepresentation","position","adjustableNumbers","showAlways","closeWithKey","_opt","_ref","reference","_ref$padding","padding","vBehaviour","hBehaviour","getInfo","preview","opacity","hue","palette","_preBuild","_buildComponents","_bindEvents","_finalBuild","color","addSwatch","_nanopop","_root","button","app","start","middle","end","right","bottom","pos","cached","_pos$split2","nanopop_slicedToArray","split","_pos$split2$","variant","isVertical","_getInfo","rb","eb","positions","variants","bevs","vars","styleprop","vertical","adder","win","v1Ok","v2Ok","margin","requestAnimationFrame","cb","offsetParent","body","setColor","_rePositioningPicker","_representation","setColorRepresentation","show","_initializingActive","_emit","hidden","int","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","so","sh","_sliders","pickr_slicedToArray","opposite","_ref2","picker","_color","cssRGBaString","background","currentColor","_recalc","_updateOutput","remove","slider","backgroundColor","selectable","_this2","eventBindings","_clearColor","setHSVA","pickr_toConsumableArray","_lastColor","applyColor","result","stopImmediatePropagation","ck","isOpen","code","some","ranges","step","range","getColorRepresentation","toLowerCase","nv","toPrecision","timeout","setTimeout","rs","clearTimeout","_eventBindings","event","_this3","_len","args","_key","_eventListener","callBacks","indexOf","splice","_this4","Color","_swatchColors","hsvaColorObject","swatchColor","silent","_this$_root","_this5","pickr","recalc","_this$components","string","_Color$parseToHSV2","utype","startsWith","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,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,EAGAC,EAAAQ,EAAA,SAAAd,EAAAe,EAAAC,GACAV,EAAAW,EAAAjB,EAAAe,IACAG,OAAAC,eAAAnB,EAAAe,EAAA,CAA0CK,YAAA,EAAAC,IAAAL,KAK1CV,EAAAgB,EAAA,SAAAtB,GACA,oBAAAuB,eAAAC,aACAN,OAAAC,eAAAnB,EAAAuB,OAAAC,YAAA,CAAwDC,MAAA,WAExDP,OAAAC,e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,EAAE0T,2DAQrG,OAAOhL,KAAK8E,mDAOZ,OAAO9E,KAAKqH,yCAOZ,OAAOrH,KAAK0C,wCAUZ,OAHA1C,KAAK2G,OACL3G,KAAKtM,QAAQ+M,UAAW,EACxBT,KAAK0C,MAAMC,OAAO/C,UAAUmG,IAAI,YACzB/F,sCASP,OAFAA,KAAKtM,QAAQ+M,UAAW,EACxBT,KAAK0C,MAAMC,OAAO/C,UAAU+H,OAAO,YAC5B3H,0CAKfF,EAAMmL,MAAQjN,EAGd8B,EAAMrN,OAAS,SAAAiB,GAAO,OAAI,IAAIoM,EAAMpM,IAGpCoM,EAAMoL,QAAU,QACDpL","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 = 0);\n","/**\r\n * Add event(s) to element(s).\r\n * @param elements DOM-Elements\r\n * @param events Event names\r\n * @param fn Callback\r\n * @param options Optional options\r\n * @return Array passed arguments\r\n */\r\nexport const on = eventListener.bind(null, 'addEventListener');\r\n\r\n/**\r\n * Remove event(s) from element(s).\r\n * @param elements DOM-Elements\r\n * @param events Event names\r\n * @param fn Callback\r\n * @param options Optional options\r\n * @return Array passed arguments\r\n */\r\nexport const off = eventListener.bind(null, 'removeEventListener');\r\n\r\nfunction eventListener(method, elements, events, fn, options = {}) {\r\n\r\n // Normalize array\r\n if (elements instanceof HTMLCollection || elements instanceof NodeList) {\r\n elements = Array.from(elements);\r\n } else if (!Array.isArray(elements)) {\r\n elements = [elements];\r\n }\r\n\r\n if (!Array.isArray(events)) {\r\n events = [events];\r\n }\r\n\r\n for (const el of elements) {\r\n for (const ev of events) {\r\n el[method](ev, fn, {capture: false, ...options});\r\n }\r\n }\r\n\r\n return Array.prototype.slice.call(arguments, 1);\r\n}\r\n\r\n/**\r\n * Creates an DOM-Element out of a string (Single element).\r\n * @param html HTML representing a single element\r\n * @returns {Element | null} The element.\r\n */\r\nexport function createElementFromString(html) {\r\n const div = document.createElement('div');\r\n div.innerHTML = html.trim();\r\n return div.firstElementChild;\r\n}\r\n\r\n/**\r\n * Removes an attribute from a HTMLElement and returns the value.\r\n * @param el\r\n * @param name\r\n * @return {string}\r\n */\r\nexport function removeAttribute(el, name) {\r\n const value = el.getAttribute(name);\r\n el.removeAttribute(name);\r\n return value;\r\n}\r\n\r\n/**\r\n * Creates a new html element, every element which has\r\n * a 'data-key' attribute will be saved in a object (which will be returned)\r\n * where the value of 'data-key' ist the object-key and the value the HTMLElement.\r\n *\r\n * It's possible to create a hierarchy if you add a 'data-con' attribute. Every\r\n * sibling will be added to the object which will get the name from the 'data-con' attribute.\r\n *\r\n * If you want to create an Array out of multiple elements, you can use the 'data-arr' attribute,\r\n * the value defines the key and all elements, which has the same parent and the same 'data-arr' attribute,\r\n * would be added to it.\r\n *\r\n * @param str - The HTML String.\r\n */\r\nexport function createFromTemplate(str) {\r\n\r\n // Recursive function to resolve template\r\n function resolve(element, base = {}) {\r\n\r\n // Check key and container attribute\r\n const con = removeAttribute(element, 'data-con');\r\n const key = removeAttribute(element, 'data-key');\r\n\r\n // Check and save element\r\n if (key) {\r\n base[key] = element;\r\n }\r\n\r\n // Check all children\r\n const subtree = con ? (base[con] = {}) : base;\r\n for (let child of Array.from(element.children)) {\r\n\r\n // Check if element should be saved as array\r\n const arr = removeAttribute(child, 'data-arr');\r\n if (arr) {\r\n\r\n // Check if there is already an array and add element\r\n (subtree[arr] || (subtree[arr] = [])).push(child);\r\n } else {\r\n resolve(child, subtree);\r\n }\r\n }\r\n\r\n return base;\r\n }\r\n\r\n return resolve(createElementFromString(str));\r\n}\r\n\r\n/**\r\n * Polyfill for safari & firefox for the eventPath event property.\r\n * @param evt The event object.\r\n * @return [String] event path.\r\n */\r\nexport function eventPath(evt) {\r\n let path = evt.path || (evt.composedPath && evt.composedPath());\r\n if (path) return path;\r\n\r\n let el = evt.target.parentElement;\r\n path = [evt.target, el];\r\n while (el = el.parentElement) path.push(el);\r\n\r\n path.push(document, window);\r\n return path;\r\n}\r\n\r\n/**\r\n * Creates the ability to change numbers in an input field with the scroll-wheel.\r\n * @param el\r\n * @param mapper\r\n */\r\nexport function adjustableInputNumbers(el, mapper = v => v) {\r\n\r\n function handleScroll(e) {\r\n const inc = ([0.001, 0.01, 0.1])[Number(e.shiftKey || e.ctrlKey * 2)] * (e.deltaY < 0 ? 1 : -1);\r\n\r\n let index = 0;\r\n let off = el.selectionStart;\r\n el.value = el.value.replace(/[\\d.]+/g, (v, i) => {\r\n\r\n // Check if number is in cursor range and increase it\r\n if (i <= off && i + v.length >= off) {\r\n off = i;\r\n return mapper(Number(v), inc, index);\r\n }\r\n\r\n index++;\r\n return v;\r\n });\r\n\r\n el.focus();\r\n el.setSelectionRange(off, off);\r\n\r\n // Prevent default and trigger input event\r\n e.preventDefault();\r\n el.dispatchEvent(new Event('input'));\r\n }\r\n\r\n // Bind events\r\n on(el, 'focus', () => on(window, 'wheel', handleScroll, {passive: false}));\r\n on(el, 'blur', () => off(window, 'wheel', handleScroll));\r\n}\r\n","// Shorthands\r\nconst {min, max, floor, round} = Math;\r\n\r\n/**\r\n * Tries to convert a color name to rgb/a hex representation\r\n * @param name\r\n * @returns {string | CanvasGradient | CanvasPattern}\r\n */\r\nfunction standardizeColor(name) {\r\n const ctx = document.createElement('canvas').getContext('2d');\r\n ctx.fillStyle = name;\r\n return ctx.fillStyle;\r\n}\r\n\r\n/**\r\n * Convert HSV spectrum to RGB.\r\n * @param h Hue\r\n * @param s Saturation\r\n * @param v Value\r\n * @returns {number[]} Array with rgb values.\r\n */\r\nexport function hsvToRgb(h, s, v) {\r\n h = (h / 360) * 6;\r\n s /= 100;\r\n v /= 100;\r\n\r\n let i = floor(h);\r\n\r\n let f = h - i;\r\n let p = v * (1 - s);\r\n let q = v * (1 - f * s);\r\n let t = v * (1 - (1 - f) * s);\r\n\r\n let mod = i % 6;\r\n let r = [v, q, p, p, t, v][mod];\r\n let g = [t, v, v, q, p, p][mod];\r\n let b = [p, p, t, v, v, q][mod];\r\n\r\n return [\r\n r * 255,\r\n g * 255,\r\n b * 255\r\n ];\r\n}\r\n\r\n/**\r\n * Convert HSV spectrum to Hex.\r\n * @param h Hue\r\n * @param s Saturation\r\n * @param v Value\r\n * @returns {string[]} Hex values\r\n */\r\nexport function hsvToHex(h, s, v) {\r\n return hsvToRgb(h, s, v).map(v =>\r\n round(v).toString(16).padStart(2, '0')\r\n );\r\n}\r\n\r\n/**\r\n * Convert HSV spectrum to CMYK.\r\n * @param h Hue\r\n * @param s Saturation\r\n * @param v Value\r\n * @returns {number[]} CMYK values\r\n */\r\nexport function hsvToCmyk(h, s, v) {\r\n const rgb = hsvToRgb(h, s, v);\r\n const r = rgb[0] / 255;\r\n const g = rgb[1] / 255;\r\n const b = rgb[2] / 255;\r\n\r\n let k, c, m, y;\r\n\r\n k = min(1 - r, 1 - g, 1 - b);\r\n\r\n c = k === 1 ? 0 : (1 - r - k) / (1 - k);\r\n m = k === 1 ? 0 : (1 - g - k) / (1 - k);\r\n y = k === 1 ? 0 : (1 - b - k) / (1 - k);\r\n\r\n return [\r\n c * 100,\r\n m * 100,\r\n y * 100,\r\n k * 100\r\n ];\r\n}\r\n\r\n/**\r\n * Convert HSV spectrum to HSL.\r\n * @param h Hue\r\n * @param s Saturation\r\n * @param v Value\r\n * @returns {number[]} HSL values\r\n */\r\nexport function hsvToHsl(h, s, v) {\r\n s /= 100, v /= 100;\r\n\r\n let l = (2 - s) * v / 2;\r\n\r\n if (l !== 0) {\r\n if (l === 1) {\r\n s = 0;\r\n } else if (l < 0.5) {\r\n s = s * v / (l * 2);\r\n } else {\r\n s = s * v / (2 - l * 2);\r\n }\r\n }\r\n\r\n return [\r\n h,\r\n s * 100,\r\n l * 100\r\n ];\r\n}\r\n\r\n/**\r\n * Convert RGB to HSV.\r\n * @param r Red\r\n * @param g Green\r\n * @param b Blue\r\n * @return {number[]} HSV values.\r\n */\r\nfunction rgbToHsv(r, g, b) {\r\n r /= 255, g /= 255, b /= 255;\r\n\r\n let h, s, v;\r\n const minVal = min(r, g, b);\r\n const maxVal = max(r, g, b);\r\n const delta = maxVal - minVal;\r\n\r\n v = maxVal;\r\n if (delta === 0) {\r\n h = s = 0;\r\n } else {\r\n s = delta / maxVal;\r\n let dr = (((maxVal - r) / 6) + (delta / 2)) / delta;\r\n let dg = (((maxVal - g) / 6) + (delta / 2)) / delta;\r\n let db = (((maxVal - b) / 6) + (delta / 2)) / delta;\r\n\r\n if (r === maxVal) {\r\n h = db - dg;\r\n } else if (g === maxVal) {\r\n h = (1 / 3) + dr - db;\r\n } else if (b === maxVal) {\r\n h = (2 / 3) + dg - dr;\r\n }\r\n\r\n if (h < 0) {\r\n h += 1;\r\n } else if (h > 1) {\r\n h -= 1;\r\n }\r\n }\r\n\r\n return [\r\n h * 360,\r\n s * 100,\r\n v * 100\r\n ];\r\n}\r\n\r\n/**\r\n * Convert CMYK to HSV.\r\n * @param c Cyan\r\n * @param m Magenta\r\n * @param y Yellow\r\n * @param k Key (Black)\r\n * @return {number[]} HSV values.\r\n */\r\nfunction cmykToHsv(c, m, y, k) {\r\n c /= 100, m /= 100, y /= 100, k /= 100;\r\n\r\n const r = (1 - min(1, c * (1 - k) + k)) * 255;\r\n const g = (1 - min(1, m * (1 - k) + k)) * 255;\r\n const b = (1 - min(1, y * (1 - k) + k)) * 255;\r\n\r\n return [...rgbToHsv(r, g, b)];\r\n}\r\n\r\n/**\r\n * Convert HSL to HSV.\r\n * @param h Hue\r\n * @param s Saturation\r\n * @param l Lightness\r\n * @return {number[]} HSV values.\r\n */\r\nfunction hslToHsv(h, s, l) {\r\n s /= 100, l /= 100;\r\n s *= l < 0.5 ? l : 1 - l;\r\n\r\n let ns = (2 * s / (l + s)) * 100;\r\n let v = (l + s) * 100;\r\n return [h, ns, v];\r\n}\r\n\r\n/**\r\n * Convert HEX to HSV.\r\n * @param hex Hexadecimal string of rgb colors, can have length 3 or 6.\r\n * @return {number[]} HSV values.\r\n */\r\nfunction hexToHsv(hex) {\r\n return rgbToHsv(...hex.match(/.{2}/g).map(v => parseInt(v, 16)));\r\n}\r\n\r\n/**\r\n * Try's to parse a string which represents a color to a HSV array.\r\n * Current supported types are cmyk, rgba, hsla and hexadecimal.\r\n * @param str\r\n * @return {*}\r\n */\r\nexport function parseToHSV(str) {\r\n\r\n // Check if string is a color-name\r\n str = str.match(/^[a-zA-Z]+$/) ? standardizeColor(str) : str;\r\n\r\n // Regular expressions to match different types of color represention\r\n const regex = {\r\n cmyk: /^cmyk[\\D]+(\\d+)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]+(\\d+)/i,\r\n rgba: /^(rgb|rgba)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]*?([\\d.]+|$)/i,\r\n hsla: /^(hsl|hsla)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]*?([\\d.]+|$)/i,\r\n hsva: /^(hsv|hsva)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]*?([\\d.]+|$)/i,\r\n hex: /^#?(([\\dA-Fa-f]{3,4})|([\\dA-Fa-f]{6})|([\\dA-Fa-f]{8}))$/i\r\n };\r\n\r\n /**\r\n * Takes an Array of any type, convert strings which represents\r\n * a number to a number an anything else to undefined.\r\n * @param array\r\n * @return {*}\r\n */\r\n const numarize = array => array.map(v => /^(|\\d+)\\.\\d+|\\d+$/.test(v) ? Number(v) : undefined);\r\n\r\n let match;\r\n for (const type in regex) {\r\n\r\n // Check if current scheme passed\r\n if (!(match = regex[type].exec(str)))\r\n continue;\r\n\r\n // Try to convert\r\n switch (type) {\r\n case 'cmyk': {\r\n let [, c, m, y, k] = numarize(match);\r\n\r\n if (c > 100 || m > 100 || y > 100 || k > 100)\r\n break;\r\n\r\n return {values: [...cmykToHsv(c, m, y, k), 1], type};\r\n }\r\n case 'rgba': {\r\n let [, , r, g, b, a = 1] = numarize(match);\r\n\r\n if (r > 255 || g > 255 || b > 255 || a < 0 || a > 1)\r\n break;\r\n\r\n return {values: [...rgbToHsv(r, g, b), a], type};\r\n }\r\n case 'hex': {\r\n const splitAt = (s, i) => [s.substring(0, i), s.substring(i, s.length)];\r\n let [, hex] = match;\r\n\r\n // Fill up opacity if not declared\r\n if (hex.length === 3) {\r\n hex += 'F';\r\n } else if (hex.length === 6) {\r\n hex += 'FF';\r\n }\r\n\r\n let alpha;\r\n if (hex.length === 4) {\r\n [hex, alpha] = splitAt(hex, 3).map(v => v + v);\r\n } else if (hex.length === 8) {\r\n [hex, alpha] = splitAt(hex, 6);\r\n }\r\n\r\n // Convert 0 - 255 to 0 - 1 for opacity\r\n alpha = parseInt(alpha, 16) / 255;\r\n return {values: [...hexToHsv(hex), alpha], type};\r\n }\r\n case 'hsla': {\r\n let [, , h, s, l, a = 1] = numarize(match);\r\n\r\n if (h > 360 || s > 100 || l > 100 || a < 0 || a > 1)\r\n break;\r\n\r\n return {values: [...hslToHsv(h, s, l), a], type};\r\n }\r\n case 'hsva': {\r\n let [, , h, s, v, a = 1] = numarize(match);\r\n\r\n if (h > 360 || s > 100 || v > 100 || a < 0 || a > 1)\r\n break;\r\n\r\n return {values: [h, s, v, a], type};\r\n }\r\n }\r\n }\r\n\r\n return {values: null, type: null};\r\n}\r\n","import {hsvToHsl, hsvToRgb, hsvToCmyk, hsvToHex} from './color';\r\n\r\n/**\r\n * Simple class which holds the properties\r\n * of the color represention model hsla (hue saturation lightness alpha)\r\n */\r\nexport function HSVaColor(h = 0, s = 0, v = 0, a = 1) {\r\n const {ceil} = Math;\r\n\r\n const that = {\r\n h, s, v, a,\r\n\r\n toHSVA() {\r\n const hsva = [that.h, that.s, that.v];\r\n const rhsva = hsva.map(ceil);\r\n\r\n hsva.push(that.a);\r\n hsva.toString = () => `hsva(${rhsva[0]}, ${rhsva[1]}%, ${rhsva[2]}%, ${that.a.toFixed(1)})`;\r\n return hsva;\r\n },\r\n\r\n toHSLA() {\r\n const hsla = hsvToHsl(that.h, that.s, that.v);\r\n const rhsla = hsla.map(ceil);\r\n\r\n hsla.push(that.a);\r\n hsla.toString = () => `hsla(${rhsla[0]}, ${rhsla[1]}%, ${rhsla[2]}%, ${that.a.toFixed(1)})`;\r\n return hsla;\r\n },\r\n\r\n toRGBA() {\r\n const rgba = hsvToRgb(that.h, that.s, that.v);\r\n const rrgba = rgba.map(ceil);\r\n\r\n rgba.push(that.a);\r\n rgba.toString = () => `rgba(${rrgba[0]}, ${rrgba[1]}, ${rrgba[2]}, ${that.a.toFixed(1)})`;\r\n return rgba;\r\n },\r\n\r\n toCMYK() {\r\n const cmyk = hsvToCmyk(that.h, that.s, that.v);\r\n const rcmyk = cmyk.map(ceil);\r\n\r\n cmyk.toString = () => `cmyk(${rcmyk[0]}%, ${rcmyk[1]}%, ${rcmyk[2]}%, ${rcmyk[3]}%)`;\r\n return cmyk;\r\n },\r\n\r\n toHEXA() {\r\n const hex = hsvToHex(that.h, that.s, that.v);\r\n\r\n hex.toString = () => {\r\n\r\n // Check if alpha channel make sense, convert it to 255 number space, convert\r\n // to hex and pad it with zeros if needet.\r\n const alpha = that.a >= 1 ? '' : Number((that.a * 255).toFixed(0))\r\n .toString(16)\r\n .toUpperCase().padStart(2, '0');\r\n\r\n return `#${hex.join('').toUpperCase() + alpha}`;\r\n };\r\n\r\n return hex;\r\n },\r\n\r\n clone() {\r\n return HSVaColor(that.h, that.s, that.v, that.a);\r\n }\r\n };\r\n\r\n return that;\r\n}\r\n","import * as _ from '../utils/utils';\r\n\r\nconst clamp = v => Math.max(Math.min(v, 1), 0);\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 lock: null,\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: {lock}, cache} = that;\r\n const {element, wrapper} = options;\r\n const b = 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 (lock !== 'h') {\r\n element.style.left = `calc(${x / b.width * 100}% - ${element.offsetWidth / 2}px)`;\r\n }\r\n\r\n if (lock !== 'v') {\r\n element.style.top = `calc(${y / b.height * 100}% - ${element.offsetHeight / 2}px)`;\r\n }\r\n\r\n that.cache = {x: x / b.width, y: y / b.height};\r\n const cx = clamp(x / wrapper.offsetWidth);\r\n const cy = clamp(y / wrapper.offsetHeight);\r\n\r\n switch (lock) {\r\n case 'v':\r\n return options.onchange(cx);\r\n case 'h':\r\n return options.onchange(cy);\r\n default:\r\n return options.onchange(cx, cy);\r\n }\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 {left, top, width, height} = that.options.wrapper.getBoundingClientRect();\r\n that._tapmove({\r\n clientX: left + width * x,\r\n clientY: top + height * 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 '../utils/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 utils\nimport * as _ from './utils/utils';\nimport * as Color from './utils/color';\n\n// Import classes\nimport {HSVaColor} from './utils/hsvacolor';\nimport Moveable from './libs/moveable';\nimport Selectable from './libs/selectable';\nimport Nanopop from './libs/nanopop';\nimport buildPickr from './template';\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 appClass: null,\n useAsButton: false,\n disabled: false,\n comparison: true,\n\n components: {\n interaction: {}\n },\n\n strings: {},\n swatches: null,\n inline: false,\n sliders: 'v',\n\n default: '#42445A',\n defaultRepresentation: null,\n position: 'bottom-middle',\n adjustableNumbers: true,\n showAlways: false,\n\n closeWithKey: 'Escape'\n }, opt);\n\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 // Initialize positioning engine\n this._nanopop = Nanopop({\n reference: this._root.button,\n el: this._root.app\n });\n\n // Initilization is finish, pickr is visible and ready for usage\n const {button} = this._root;\n const that = this;\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);\n }\n\n // Apply default color\n that.setColor(opt.default);\n that._rePositioningPicker();\n\n // Initialize color representation\n if (opt.defaultRepresentation) {\n that._representation = opt.defaultRepresentation;\n that.setColorRepresentation(that._representation);\n }\n\n // Show pickr if locked\n if (opt.showAlways) {\n that.show();\n }\n\n // Initialization is done - pickr is usable, fire init event\n that._initializingActive = false;\n that._emit('init');\n }));\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 = buildPickr(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 const [so, sh] = (() => {\n const {sliders} = inst.options;\n let so = 'v', sh = 'v';\n\n if (sliders.match(/^[vh]+$/g)) {\n if (sliders.length > 1) {\n [so, sh] = sliders;\n } else {\n so = sh = sliders;\n }\n }\n\n const opposite = {v: 'h', h: 'v'};\n return [opposite[so], opposite[sh]];\n })();\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 * 100;\n\n // Calculate the value\n _color.v = 100 - y * 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 (!inst.options.comparison) {\n\n // If the user changes the color, remove the cleared icon\n _root.button.classList.remove('clear');\n }\n }\n }),\n\n hue: Moveable({\n lock: sh,\n element: inst._root.hue.picker,\n wrapper: inst._root.hue.slider,\n\n onchange(v) {\n if (!comp.hue || !comp.palette) return;\n\n // Calculate hue\n inst._color.h = v * 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 lock: so,\n element: inst._root.opacity.picker,\n wrapper: inst._root.opacity.slider,\n\n onchange(v) {\n if (!comp.opacity || !comp.palette) return;\n\n // Calculate opacity\n inst._color.a = Math.round(v * 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 const ranges = {\n rgba: [255, 255, 255, 1],\n hsva: [360, 100, 100, 1],\n hsla: [360, 100, 100, 1],\n cmyk: [100, 100, 100, 100]\n };\n\n _.adjustableInputNumbers(_root.interaction.result, (o, step, index) => {\n const range = ranges[this.getColorRepresentation().toLowerCase()];\n\n if (range) {\n const max = range[index];\n\n // Calculate next reasonable number\n const nv = o + (max >= 100 ? step * 1000 : step);\n\n // Apply range of zero up to max, fix floating-point issues\n return nv <= 0 ? 0 : Number((nv < max ? nv : max).toPrecision(3));\n } else {\n return o;\n }\n });\n }\n\n if (!options.inline) {\n let timeout = null;\n const that = this;\n\n // Re-calc position on window resize, scroll and wheel\n eventBindings.push(\n _.on(window, ['scroll', 'resize'], () => {\n if (that.isOpen()) {\n if (timeout === null) {\n timeout = setTimeout(() => timeout = null, 100);\n\n // Update position on every frame\n requestAnimationFrame(function rs() {\n that._rePositioningPicker();\n (timeout !== null) && requestAnimationFrame(rs);\n });\n } else {\n clearTimeout(timeout);\n timeout = setTimeout(() => timeout = null, 100);\n }\n }\n })\n );\n }\n\n // Save bindings\n this._eventBindings = eventBindings;\n }\n\n _rePositioningPicker() {\n const {options} = this;\n\n // No repositioning needed if inline\n if (!options.inline) {\n this._nanopop.update(options.position);\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 // Override current color and re-active color calculation\n this._color = HSVaColor(h, s, v, a);\n\n // Update slider and palette\n const {hue, opacity, palette} = this.components;\n hue.update(0, (h / 360));\n opacity.update(0, a);\n palette.update(s / 100, 1 - (v / 100));\n\n // Restore old state\n this._recalc = recalc;\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\n// Expose pickr utils\nPickr.utils = _;\n\n// Create instance via method\nPickr.create = options => new Pickr(options);\n\n// Assign version and export\nPickr.version = '0.6.4';\nexport default Pickr;\n","/**\n * Micro positioning-engine\n * @param el\n * @param reference\n * @param pos\n * @param padding\n * @returns {{update(): void}}\n * @constructor\n */\nexport default function Nanopop({el, reference, padding = 8}) {\n const vBehaviour = {start: 'sme', middle: 'mse', end: 'ems'};\n const hBehaviour = {top: 'tb', right: 'rl', bottom: 'bt', left: 'lr'};\n\n const getInfo = ((cache = {}) => (pos, cached = cache[pos]) => {\n if (cached) return cached;\n const [position, variant = 'middle'] = pos.split('-');\n const isVertical = (position === 'top' || position === 'bottom');\n\n return cache[pos] = {\n position,\n variant,\n isVertical\n };\n })();\n\n return {\n update(pos) {\n const {position, variant, isVertical} = getInfo(pos);\n const rb = reference.getBoundingClientRect();\n const eb = el.getBoundingClientRect();\n\n const positions = isVertical ? {\n t: rb.top - eb.height - padding,\n b: rb.bottom + padding\n } : {\n r: rb.right + padding,\n l: rb.left - eb.width - padding\n };\n\n const variants = isVertical ? {\n s: rb.left + rb.width - eb.width,\n m: (-eb.width / 2) + (rb.left + rb.width / 2),\n e: rb.left\n } : {\n s: rb.bottom - eb.height,\n m: rb.bottom - rb.height / 2 - eb.height / 2,\n e: rb.bottom - rb.height\n };\n\n\n function apply(bevs, vars, styleprop) {\n const vertical = styleprop === 'top';\n const adder = vertical ? eb.height : eb.width;\n const win = window[vertical ? 'innerHeight' : 'innerWidth'];\n\n for (const ch of bevs) {\n const v = vars[ch];\n if (v > 0 && (v + adder) < win) {\n el.style[styleprop] = `${v}px`;\n return true;\n }\n }\n\n return false;\n }\n\n const v1Ok = apply(vBehaviour[variant], variants, isVertical ? 'left' : 'top');\n const v2Ok = apply(hBehaviour[position], positions, isVertical ? 'top' : 'left');\n if (!v1Ok || !v2Ok) {\n Object.assign(el.style, {\n top: `${padding}px`,\n left: 0,\n right: 0,\n margin: 'auto'\n });\n } else {\n el.style.margin = 'inherit';\n }\n }\n };\n}\n","import * as _ from './utils/utils';\r\n\r\nexport default ({components: c, strings: s, useAsButton, inline, appClass}) => {\r\n const hidden = con => con ? '' : 'style=\"display:none\" hidden';\r\n\r\n const root = _.createFromTemplate(`\r\n
\r\n\r\n ${useAsButton ? '' : ''}\r\n\r\n
\r\n
\r\n
\r\n \r\n
\r\n
\r\n\r\n
\r\n
\r\n
\r\n
\r\n\r\n
\r\n
\r\n
\r\n
\r\n\r\n
\r\n
\r\n
\r\n
\r\n
\r\n\r\n
\r\n\r\n
\r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n
\r\n
\r\n
\r\n `);\r\n\r\n const int = root.interaction;\r\n\r\n // Select option which is not hidden\r\n int.options.find(o => !o.hidden && !o.classList.add('active'));\r\n\r\n // Create method to find currenlty active option\r\n int.type = () => int.options.find(e => e.classList.contains('active'));\r\n return root;\r\n}\r\n"],"sourceRoot":""} \ No newline at end of file diff --git a/dist/pickr.min.js b/dist/pickr.min.js index b9fd1810..632ebe12 100644 --- a/dist/pickr.min.js +++ b/dist/pickr.min.js @@ -1,3 +1,3 @@ /*! Pickr 0.6.4 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=0)}([function(t,e,n){"use strict";n.r(e);var o={};function i(t){for(var e=1;et)){function n(n){const o=[.001,.01,.1][Number(n.shiftKey||2*n.ctrlKey)]*(n.deltaY<0?1:-1);let i=0,s=t.selectionStart;t.value=t.value.replace(/[\d.]+/g,(t,n)=>n<=s&&n+t.length>=s?(s=n,e(Number(t),o,i)):(i++,t)),t.focus(),t.setSelectionRange(s,s),n.preventDefault(),t.dispatchEvent(new Event("input"))}r(t,"focus",()=>r(window,"wheel",n,{passive:!1})),r(t,"blur",()=>a(window,"wheel",n))}const{min:f,max:m,floor:v,round:y}=Math;function b(t,e,n){e/=100,n/=100;let o=v(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 g(t,e,n){let o,i,s;const r=f(t/=255,e/=255,n/=255),a=m(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,[...g(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 g(...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 i in e)if(o=e[i].exec(t))switch(i){case"cmyk":{let[,t,e,s,r]=n(o);if(t>100||e>100||s>100||r>100)break;return{values:[..._(t,e,s,r),1],type:i}}case"rgba":{let[,,t,e,s,r=1]=n(o);if(t>255||e>255||s>255||r<0||r>1)break;return{values:[...g(t,e,s),r],type:i}}case"hex":{const t=(t,e)=>[t.substring(0,e),t.substring(e,t.length)];let e,[,n]=o;return 3===n.length?n+="F":6===n.length&&(n+="FF"),4===n.length?[n,e]=t(n,3).map(t=>t+t):8===n.length&&([n,e]=t(n,6)),e=parseInt(e,16)/255,{values:[...k(n),e],type:i}}case"hsla":{let[,,t,e,s,r=1]=n(o);if(t>360||e>100||s>100||r<0||r>1)break;return{values:[...w(t,e,s),r],type:i}}case"hsva":{let[,,t,e,s,r=1]=n(o);if(t>360||e>100||s>100||r<0||r>1)break;return{values:[t,e,s,r],type:i}}}return{values:null,type:null}}function C(t=0,e=0,n=0,o=1){const{ceil:i}=Math,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=b(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=b(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=function(t,e,n){return b(t,e,n).map(t=>y(t).toString(16).padStart(2,"0"))}(s.h,s.s,s.v);return t.toString=()=>{const e=s.a>=1?"":Number((255*s.a).toFixed(0)).toString(16).toUpperCase().padStart(2,"0");return"#".concat(t.join("").toUpperCase()+e)},t},clone:()=>C(s.h,s.s,s.v,s.a)};return s}const S=t=>Math.max(Math.min(t,1),0);function O(t){const e={options:Object.assign({lock:null,onchange:()=>0},t),_tapstart(t){r(document,["mouseup","touchend","touchcancel"],e._tapstop),r(document,["mousemove","touchmove"],e._tapmove),t.preventDefault(),e._tapmove(t)},_tapmove(t){const{options:{lock:o},cache:i}=e,{element:s,wrapper:r}=n,a=r.getBoundingClientRect();let c=0,l=0;if(t){const e=t&&t.touches&&t.touches[0];c=t?(e||t).clientX:0,l=t?(e||t).clientY:0,ca.left+a.width&&(c=a.left+a.width),la.top+a.height&&(l=a.top+a.height),c-=a.left,l-=a.top}else i&&(c=i.x*a.width,l=i.y*a.height);"h"!==o&&(s.style.left="calc(".concat(c/a.width*100,"% - ").concat(s.offsetWidth/2,"px)")),"v"!==o&&(s.style.top="calc(".concat(l/a.height*100,"% - ").concat(s.offsetHeight/2,"px)")),e.cache={x:c/a.width,y:l/a.height};const p=S(c/r.offsetWidth),u=S(l/r.offsetHeight);switch(o){case"v":return n.onchange(p);case"h":return n.onchange(u);default:return n.onchange(p,u)}},_tapstop(){a(document,["mouseup","touchend","touchcancel"],e._tapstop),a(document,["mousemove","touchmove"],e._tapmove)},trigger(){e._tapmove()},update(t=0,n=0){const{left:o,top:i,width:s,height:r}=e.options.wrapper.getBoundingClientRect();e._tapmove({clientX:o+s*t,clientY:i+r*n})},destroy(){const{options:t,_tapstart:n}=e;a([t.wrapper,t.element],"mousedown",n),a([t.wrapper,t.element],"touchstart",n,{passive:!1})}},{options:n,_tapstart:o}=e;return r([n.wrapper,n.element],"mousedown",o),r([n.wrapper,n.element],"touchstart",o,{passive:!1}),e}function x(t={}){t=Object.assign({onchange:()=>0,className:"",elements:[]},t);const e=r(t.elements,"click",e=>{t.elements.forEach(n=>n.classList[e.target===n?"add":"remove"](t.className)),t.onchange(e)});return{destroy:()=>a(...e)}}var j=({components:t,strings:e,useAsButton:n,inline:o,appClass:i})=>{const s=t=>t?"":'style="display:none" hidden',r=u('\n
\n\n '.concat(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 ")),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};function B(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}class E{constructor(t){B(this,"_initializingActive",!0),B(this,"_recalc",!0),B(this,"_color",C()),B(this,"_lastColor",C()),B(this,"_swatchColors",[]),B(this,"_eventListener",{swatchselect:[],change:[],save:[],init:[]}),this.options=t=Object.assign({appClass:null,useAsButton:!1,disabled:!1,comparison:!0,components:{interaction:{}},strings:{},swatches:null,inline:!1,sliders:"v",default:"#42445A",defaultRepresentation:null,position:"bottom-middle",adjustableNumbers:!0,showAlways:!1,closeWithKey:"Escape"},t);const{swatches:e,inline:n,components:o,position:i}=t;o.interaction||(o.interaction={});const{preview:s,opacity:r,hue:a,palette:c}=o;o.palette=c||s||r||a,n&&(t.showAlways=!0),this._preBuild(),this._buildComponents(),this._bindEvents(),this._finalBuild(),e&&e.length&&e.forEach(t=>this.addSwatch(t)),this._nanopop=function({el:t,reference:e,pos:n,padding:o=8}){const i={start:"sme",middle:"mse",end:"ems"},s={top:"tb",right:"rl",bottom:"bt",left:"lr"},[r,a="middle"]=n.split("-"),c="top"===r||"bottom"===r;return{update(){const n=e.getBoundingClientRect(),l=t.getBoundingClientRect(),p=c?{t:n.top-l.height-o,b:n.bottom+o}:{r:n.right+o,l:n.left-l.width-o},u=c?{s:n.left+n.width-l.width,m:-l.width/2+(n.left+n.width/2),e:n.left}:{s:n.bottom-l.height,m:n.bottom-n.height/2-l.height/2,e:n.bottom-n.height};function h(e,n,o){const i="top"===o,s=i?l.height:l.width,r=window[i?"innerHeight":"innerWidth"];for(const i of e){const e=n[i];if(e>0&&e+s>/g).reduce((t,e,n,o)=>(t=t.querySelector(e),n{const{sliders:e}=t.options;let n="v",o="v";e.match(/^[vh]+$/g)&&(e.length>1?[n,o]=e:n=o=e);const i={v:"h",h:"v"};return[i[n],i[o]]})(),i={palette:O({element:t._root.palette.picker,wrapper:t._root.palette.palette,onchange(n,o){if(!e.palette)return;const{_color:i,_root:s,options:r}=t;i.s=100*n,i.v=100-100*o,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(),t.options.comparison||s.button.classList.remove("clear")}}),hue:O({lock:o,element:t._root.hue.picker,wrapper:t._root.hue.slider,onchange(n){e.hue&&e.palette&&(t._color.h=360*n,this.element.style.backgroundColor="hsl(".concat(t._color.h,", 100%, 50%)"),i.palette.trigger())}}),opacity:O({lock:n,element:t._root.opacity.picker,wrapper:t._root.opacity.slider,onchange(n){e.opacity&&e.palette&&(t._color.a=Math.round(100*n)/100,this.element.style.background="rgba(0, 0, 0, ".concat(t._color.a,")"),t.components.palette.trigger())}}),selectable:x({elements:t._root.interaction.options,className:"active",onchange(e){t._representation=e.target.getAttribute("data-type").toUpperCase(),t._updateOutput()}})};this.components=i}_bindEvents(){const{_root:t,options:e}=this,n=[r(t.interaction.clear,"click",()=>this._clearColor()),r(t.preview.lastColor,"click",()=>this.setHSVA(...this._lastColor.toHSVA())),r(t.interaction.save,"click",()=>{!this.applyColor()&&!e.showAlways&&this.hide()}),r(t.interaction.result,["keyup","input"],t=>{this._recalc=!1,this.setColor(t.target.value,!0)&&!this._initializingActive&&this._emit("change",this._color),t.stopImmediatePropagation()}),r([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(r(t.button,"click",()=>this.isOpen()?this.hide():this.show()),r(document,"keyup",t=>this.isOpen()&&(t.key===o||t.code===o)&&this.hide()),r(document,["touchstart","mousedown"],e=>{this.isOpen()&&!h(e).some(e=>e===t.app||e===t.button)&&this.hide()},{capture:!0}))}if(e.adjustableNumbers){const e={rgba:[255,255,255,1],hsva:[360,100,100,1],hsla:[360,100,100,1],cmyk:[100,100,100,100]};d(t.interaction.result,(t,n,o)=>{const i=e[this.getColorRepresentation().toLowerCase()];if(i){const e=i[o],s=t+(e>=100?1e3*n:n);return s<=0?0:Number((s{e.isOpen()&&(null===t?(t=setTimeout(()=>t=null,100),requestAnimationFrame(function n(){e._rePositioningPicker(),null!==t&&requestAnimationFrame(n)})):(clearTimeout(t),t=setTimeout(()=>t=null,100)))}))}this._eventBindings=n}_rePositioningPicker(){this.options.inline||this._nanopop.update()}_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{_root:t,options:e}=this;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,...e){this._eventListener[t].forEach(t=>t(...e,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{values:e}=A(t);if(e){const{_swatchColors:t,_root:n}=this,o=C(...e),i=l(''));return n.swatches.appendChild(i),t.push({element:i,hsvaColorObject:o}),this._eventBindings.push(r(i,"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{element:n}=e;return this._root.swatches.removeChild(n),this._swatchColors.splice(t,1),!0}}return!1}applyColor(t=!1){const{preview:e,button:n}=this._root,o=this._color.toRGBA().toString();e.lastColor.style.color=o,this.options.useAsButton||(n.style.color=o),n.classList.remove("clear"),this._lastColor=this._color.clone(),this._initializingActive||t||this._emit("save",this._color)}destroy(){this._eventBindings.forEach(t=>a(...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(t=360,e=0,n=0,o=1,i=!1){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;this._color=C(t,e,n,o);const{hue:r,opacity:a,palette:c}=this.components;return r.update(0,t/360),a.update(0,o),c.update(e/100,1-n/100),this._recalc=s,this._recalc&&this._updateOutput(),i||this.applyColor(),!0}setColor(t,e=!1){if(null===t)return this._clearColor(),!0;const{values:n,type:o}=A(t);if(n){const t=o.toUpperCase(),{options:i}=this._root.interaction,s=i.find(e=>e.getAttribute("data-type").startsWith(t));if(s&&!s.hidden)for(const t of i)t.classList[t===s?"add":"remove"]("active");return this.setHSVA(...n,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}}E.utils=o,E.create=t=>new E(t),E.version="0.6.4";e.default=E}]).default}); +!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=0)}([function(t,e,n){"use strict";n.r(e);var o={};function i(t){for(var e=1;et)){function n(n){const o=[.001,.01,.1][Number(n.shiftKey||2*n.ctrlKey)]*(n.deltaY<0?1:-1);let i=0,r=t.selectionStart;t.value=t.value.replace(/[\d.]+/g,(t,n)=>n<=r&&n+t.length>=r?(r=n,e(Number(t),o,i)):(i++,t)),t.focus(),t.setSelectionRange(r,r),n.preventDefault(),t.dispatchEvent(new Event("input"))}s(t,"focus",()=>s(window,"wheel",n,{passive:!1})),s(t,"blur",()=>a(window,"wheel",n))}const{min:f,max:m,floor:v,round:y}=Math;function b(t,e,n){e/=100,n/=100;let o=v(t=t/360*6),i=t-o,r=n*(1-e),s=n*(1-i*e),a=n*(1-(1-i)*e),c=o%6;return[255*[n,s,r,r,a,n][c],255*[a,n,n,s,r,r][c],255*[r,r,a,n,n,s][c]]}function g(t,e,n){let o,i,r;const s=f(t/=255,e/=255,n/=255),a=m(t,e,n),c=a-s;if(0===c)o=i=0;else{i=c/a;let r=((a-t)/6+c/2)/c,s=((a-e)/6+c/2)/c,l=((a-n)/6+c/2)/c;t===a?o=l-s:e===a?o=1/3+r-l:n===a&&(o=2/3+s-r),o<0?o+=1:o>1&&(o-=1)}return[360*o,100*i,100*(r=a)]}function _(t,e,n,o){return e/=100,n/=100,[...g(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 g(...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 i in e)if(o=e[i].exec(t))switch(i){case"cmyk":{let[,t,e,r,s]=n(o);if(t>100||e>100||r>100||s>100)break;return{values:[..._(t,e,r,s),1],type:i}}case"rgba":{let[,,t,e,r,s=1]=n(o);if(t>255||e>255||r>255||s<0||s>1)break;return{values:[...g(t,e,r),s],type:i}}case"hex":{const t=(t,e)=>[t.substring(0,e),t.substring(e,t.length)];let e,[,n]=o;return 3===n.length?n+="F":6===n.length&&(n+="FF"),4===n.length?[n,e]=t(n,3).map(t=>t+t):8===n.length&&([n,e]=t(n,6)),e=parseInt(e,16)/255,{values:[...k(n),e],type:i}}case"hsla":{let[,,t,e,r,s=1]=n(o);if(t>360||e>100||r>100||s<0||s>1)break;return{values:[...w(t,e,r),s],type:i}}case"hsva":{let[,,t,e,r,s=1]=n(o);if(t>360||e>100||r>100||s<0||s>1)break;return{values:[t,e,r,s],type:i}}}return{values:null,type:null}}function C(t=0,e=0,n=0,o=1){const{ceil:i}=Math,r={h:t,s:e,v:n,a:o,toHSVA(){const t=[r.h,r.s,r.v],e=t.map(i);return t.push(r.a),t.toString=()=>"hsva(".concat(e[0],", ").concat(e[1],"%, ").concat(e[2],"%, ").concat(r.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]}(r.h,r.s,r.v),e=t.map(i);return t.push(r.a),t.toString=()=>"hsla(".concat(e[0],", ").concat(e[1],"%, ").concat(e[2],"%, ").concat(r.a.toFixed(1),")"),t},toRGBA(){const t=b(r.h,r.s,r.v),e=t.map(i);return t.push(r.a),t.toString=()=>"rgba(".concat(e[0],", ").concat(e[1],", ").concat(e[2],", ").concat(r.a.toFixed(1),")"),t},toCMYK(){const t=function(t,e,n){const o=b(t,e,n),i=o[0]/255,r=o[1]/255,s=o[2]/255;let a,c,l,p;return[100*(c=1===(a=f(1-i,1-r,1-s))?0:(1-i-a)/(1-a)),100*(l=1===a?0:(1-r-a)/(1-a)),100*(p=1===a?0:(1-s-a)/(1-a)),100*a]}(r.h,r.s,r.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=function(t,e,n){return b(t,e,n).map(t=>y(t).toString(16).padStart(2,"0"))}(r.h,r.s,r.v);return t.toString=()=>{const e=r.a>=1?"":Number((255*r.a).toFixed(0)).toString(16).toUpperCase().padStart(2,"0");return"#".concat(t.join("").toUpperCase()+e)},t},clone:()=>C(r.h,r.s,r.v,r.a)};return r}const S=t=>Math.max(Math.min(t,1),0);function O(t){const e={options:Object.assign({lock:null,onchange:()=>0},t),_tapstart(t){s(document,["mouseup","touchend","touchcancel"],e._tapstop),s(document,["mousemove","touchmove"],e._tapmove),t.preventDefault(),e._tapmove(t)},_tapmove(t){const{options:{lock:o},cache:i}=e,{element:r,wrapper:s}=n,a=s.getBoundingClientRect();let c=0,l=0;if(t){const e=t&&t.touches&&t.touches[0];c=t?(e||t).clientX:0,l=t?(e||t).clientY:0,ca.left+a.width&&(c=a.left+a.width),la.top+a.height&&(l=a.top+a.height),c-=a.left,l-=a.top}else i&&(c=i.x*a.width,l=i.y*a.height);"h"!==o&&(r.style.left="calc(".concat(c/a.width*100,"% - ").concat(r.offsetWidth/2,"px)")),"v"!==o&&(r.style.top="calc(".concat(l/a.height*100,"% - ").concat(r.offsetHeight/2,"px)")),e.cache={x:c/a.width,y:l/a.height};const p=S(c/s.offsetWidth),u=S(l/s.offsetHeight);switch(o){case"v":return n.onchange(p);case"h":return n.onchange(u);default:return n.onchange(p,u)}},_tapstop(){a(document,["mouseup","touchend","touchcancel"],e._tapstop),a(document,["mousemove","touchmove"],e._tapmove)},trigger(){e._tapmove()},update(t=0,n=0){const{left:o,top:i,width:r,height:s}=e.options.wrapper.getBoundingClientRect();e._tapmove({clientX:o+r*t,clientY:i+s*n})},destroy(){const{options:t,_tapstart:n}=e;a([t.wrapper,t.element],"mousedown",n),a([t.wrapper,t.element],"touchstart",n,{passive:!1})}},{options:n,_tapstart:o}=e;return s([n.wrapper,n.element],"mousedown",o),s([n.wrapper,n.element],"touchstart",o,{passive:!1}),e}function x(t={}){t=Object.assign({onchange:()=>0,className:"",elements:[]},t);const e=s(t.elements,"click",e=>{t.elements.forEach(n=>n.classList[e.target===n?"add":"remove"](t.className)),t.onchange(e)});return{destroy:()=>a(...e)}}var j=({components:t,strings:e,useAsButton:n,inline:o,appClass:i})=>{const r=t=>t?"":'style="display:none" hidden',s=u('\n
\n\n '.concat(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 ")),a=s.interaction;return a.options.find(t=>!t.hidden&&!t.classList.add("active")),a.type=()=>a.options.find(t=>t.classList.contains("active")),s};function B(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}class E{constructor(t){B(this,"_initializingActive",!0),B(this,"_recalc",!0),B(this,"_color",C()),B(this,"_lastColor",C()),B(this,"_swatchColors",[]),B(this,"_eventListener",{swatchselect:[],change:[],save:[],init:[]}),this.options=t=Object.assign({appClass:null,useAsButton:!1,disabled:!1,comparison:!0,components:{interaction:{}},strings:{},swatches:null,inline:!1,sliders:"v",default:"#42445A",defaultRepresentation:null,position:"bottom-middle",adjustableNumbers:!0,showAlways:!1,closeWithKey:"Escape"},t);const{swatches:e,inline:n,components:o}=t;o.interaction||(o.interaction={});const{preview:i,opacity:r,hue:s,palette:a}=o;o.palette=a||i||r||s,n&&(t.showAlways=!0),this._preBuild(),this._buildComponents(),this._bindEvents(),this._finalBuild(),e&&e.length&&e.forEach(t=>this.addSwatch(t)),this._nanopop=function({el:t,reference:e,padding:n=8}){const o={start:"sme",middle:"mse",end:"ems"},i={top:"tb",right:"rl",bottom:"bt",left:"lr"},r=((t={})=>(e,n=t[e])=>{if(n)return n;const[o,i="middle"]=e.split("-"),r="top"===o||"bottom"===o;return t[e]={position:o,variant:i,isVertical:r}})();return{update(s){const{position:a,variant:c,isVertical:l}=r(s),p=e.getBoundingClientRect(),u=t.getBoundingClientRect(),h=l?{t:p.top-u.height-n,b:p.bottom+n}:{r:p.right+n,l:p.left-u.width-n},d=l?{s:p.left+p.width-u.width,m:-u.width/2+(p.left+p.width/2),e:p.left}:{s:p.bottom-u.height,m:p.bottom-p.height/2-u.height/2,e:p.bottom-p.height};function f(e,n,o){const i="top"===o,r=i?u.height:u.width,s=window[i?"innerHeight":"innerWidth"];for(const i of e){const e=n[i];if(e>0&&e+r>/g).reduce((t,e,n,o)=>(t=t.querySelector(e),n{const{sliders:e}=t.options;let n="v",o="v";e.match(/^[vh]+$/g)&&(e.length>1?[n,o]=e:n=o=e);const i={v:"h",h:"v"};return[i[n],i[o]]})(),i={palette:O({element:t._root.palette.picker,wrapper:t._root.palette.palette,onchange(n,o){if(!e.palette)return;const{_color:i,_root:r,options:s}=t;i.s=100*n,i.v=100-100*o,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 "),s.comparison||(r.button.style.color=a,s.useAsButton||(r.preview.lastColor.style.color=a)),r.preview.currentColor.style.color=a,t._recalc&&t._updateOutput(),t.options.comparison||r.button.classList.remove("clear")}}),hue:O({lock:o,element:t._root.hue.picker,wrapper:t._root.hue.slider,onchange(n){e.hue&&e.palette&&(t._color.h=360*n,this.element.style.backgroundColor="hsl(".concat(t._color.h,", 100%, 50%)"),i.palette.trigger())}}),opacity:O({lock:n,element:t._root.opacity.picker,wrapper:t._root.opacity.slider,onchange(n){e.opacity&&e.palette&&(t._color.a=Math.round(100*n)/100,this.element.style.background="rgba(0, 0, 0, ".concat(t._color.a,")"),t.components.palette.trigger())}}),selectable:x({elements:t._root.interaction.options,className:"active",onchange(e){t._representation=e.target.getAttribute("data-type").toUpperCase(),t._updateOutput()}})};this.components=i}_bindEvents(){const{_root:t,options:e}=this,n=[s(t.interaction.clear,"click",()=>this._clearColor()),s(t.preview.lastColor,"click",()=>this.setHSVA(...this._lastColor.toHSVA())),s(t.interaction.save,"click",()=>{!this.applyColor()&&!e.showAlways&&this.hide()}),s(t.interaction.result,["keyup","input"],t=>{this._recalc=!1,this.setColor(t.target.value,!0)&&!this._initializingActive&&this._emit("change",this._color),t.stopImmediatePropagation()}),s([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(s(t.button,"click",()=>this.isOpen()?this.hide():this.show()),s(document,"keyup",t=>this.isOpen()&&(t.key===o||t.code===o)&&this.hide()),s(document,["touchstart","mousedown"],e=>{this.isOpen()&&!h(e).some(e=>e===t.app||e===t.button)&&this.hide()},{capture:!0}))}if(e.adjustableNumbers){const e={rgba:[255,255,255,1],hsva:[360,100,100,1],hsla:[360,100,100,1],cmyk:[100,100,100,100]};d(t.interaction.result,(t,n,o)=>{const i=e[this.getColorRepresentation().toLowerCase()];if(i){const e=i[o],r=t+(e>=100?1e3*n:n);return r<=0?0:Number((r{e.isOpen()&&(null===t?(t=setTimeout(()=>t=null,100),requestAnimationFrame(function n(){e._rePositioningPicker(),null!==t&&requestAnimationFrame(n)})):(clearTimeout(t),t=setTimeout(()=>t=null,100)))}))}this._eventBindings=n}_rePositioningPicker(){const{options:t}=this;t.inline||this._nanopop.update(t.position)}_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{_root:t,options:e}=this;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,...e){this._eventListener[t].forEach(t=>t(...e,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{values:e}=A(t);if(e){const{_swatchColors:t,_root:n}=this,o=C(...e),i=l(''));return n.swatches.appendChild(i),t.push({element:i,hsvaColorObject:o}),this._eventBindings.push(s(i,"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{element:n}=e;return this._root.swatches.removeChild(n),this._swatchColors.splice(t,1),!0}}return!1}applyColor(t=!1){const{preview:e,button:n}=this._root,o=this._color.toRGBA().toString();e.lastColor.style.color=o,this.options.useAsButton||(n.style.color=o),n.classList.remove("clear"),this._lastColor=this._color.clone(),this._initializingActive||t||this._emit("save",this._color)}destroy(){this._eventBindings.forEach(t=>a(...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(t=360,e=0,n=0,o=1,i=!1){const r=this._recalc;if(this._recalc=!1,t<0||t>360||e<0||e>100||n<0||n>100||o<0||o>1)return!1;this._color=C(t,e,n,o);const{hue:s,opacity:a,palette:c}=this.components;return s.update(0,t/360),a.update(0,o),c.update(e/100,1-n/100),this._recalc=r,this._recalc&&this._updateOutput(),i||this.applyColor(),!0}setColor(t,e=!1){if(null===t)return this._clearColor(),!0;const{values:n,type:o}=A(t);if(n){const t=o.toUpperCase(),{options:i}=this._root.interaction,r=i.find(e=>e.getAttribute("data-type").startsWith(t));if(r&&!r.hidden)for(const t of i)t.classList[t===r?"add":"remove"]("active");return this.setHSVA(...n,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}}E.utils=o,E.create=t=>new E(t),E.version="0.6.4";e.default=E}]).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 7e13fbf0..6f30d69e 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/utils/utils.js","webpack:///./src/js/utils/color.js","webpack:///./src/js/utils/hsvacolor.js","webpack:///./src/js/libs/moveable.js","webpack:///./src/js/libs/selectable.js","webpack:///./src/js/template.js","webpack:///./src/js/pickr.js","webpack:///./src/js/libs/nanopop.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","HTMLCollection","NodeList","Array","from","isArray","el","ev","_objectSpread","capture","slice","arguments","createElementFromString","html","div","document","createElement","innerHTML","trim","firstElementChild","removeAttribute","getAttribute","createFromTemplate","str","resolve","element","base","con","subtree","child","children","arr","push","eventPath","evt","path","composedPath","target","parentElement","adjustableInputNumbers","mapper","v","handleScroll","e","inc","Number","shiftKey","ctrlKey","deltaY","index","selectionStart","replace","length","focus","setSelectionRange","preventDefault","dispatchEvent","Event","passive","min","max","floor","round","Math","hsvToRgb","h","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","undefined","type","exec","values","a","splitAt","substring","alpha","HSVaColor","ceil","that","toHSVA","rhsva","toString","concat","toFixed","toHSLA","hsvToHsl","rhsla","toRGBA","rrgba","toCMYK","rgb","hsvToCmyk","rcmyk","toHEXA","padStart","hsvToHex","toUpperCase","join","clone","clamp","Moveable","opt","assign","lock","onchange","_tapstart","_","_tapstop","_tapmove","cache","wrapper","getBoundingClientRect","x","touch","touches","clientX","clientY","left","width","top","height","style","offsetWidth","offsetHeight","cx","cy","trigger","update","destroy","Selectable","className","onTap","forEach","classList","template","components","strings","useAsButton","inline","appClass","hidden","palette","preview","hue","opacity","keys","interaction","input","save","clear","int","find","add","contains","Pickr","constructor","pickr_defineProperty","this","swatchselect","change","init","disabled","comparison","swatches","sliders","default","defaultRepresentation","position","adjustableNumbers","showAlways","closeWithKey","_preBuild","_buildComponents","_bindEvents","_finalBuild","color","addSwatch","_nanopop","reference","pos","padding","vBehaviour","start","middle","end","hBehaviour","right","bottom","variant","split","isVertical","rb","eb","positions","variants","apply","bevs","vars","styleprop","vertical","adder","win","ch","Nanopop","_root","button","app","requestAnimationFrame","cb","offsetParent","body","setColor","_rePositioningPicker","_representation","setColorRepresentation","show","_initializingActive","_emit","reduce","pv","cv","ci","querySelector","shadowRoot","buildPickr","appendChild","removeChild","lastChild","insertBefore","nextSibling","parentNode","replaceChild","disable","transition","lastColor","hide","inst","comp","so","sh","opposite","picker","_color","cssRGBaString","background","currentColor","_recalc","_updateOutput","remove","slider","backgroundColor","selectable","eventBindings","_clearColor","setHSVA","_lastColor","applyColor","result","stopImmediatePropagation","ck","isOpen","code","some","ranges","step","range","getColorRepresentation","toLowerCase","nv","toPrecision","timeout","setTimeout","rs","clearTimeout","_eventBindings","event","args","_eventListener","callBacks","indexOf","splice","Color","_swatchColors","hsvaColorObject","removeSwatch","swatchColor","silent","destroyAndRemove","pickr","recalc","string","utype","startsWith","click","getColor","getRoot","enable","utils","version"],"mappings":";CAAA,SAAAA,EAAAC,GACA,iBAAAC,SAAA,iBAAAC,OACAA,OAAAD,QAAAD,IACA,mBAAAG,eAAAC,IACAD,OAAA,GAAAH,GACA,iBAAAC,QACAA,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AW,IAAI0L,EAAM1L,GAGpC0L,EAAMgJ,QAAU,QACDhJ","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 = 0);\n","/**\r\n * Add event(s) to element(s).\r\n * @param elements DOM-Elements\r\n * @param events Event names\r\n * @param fn Callback\r\n * @param options Optional options\r\n * @return Array passed arguments\r\n */\r\nexport const on = eventListener.bind(null, 'addEventListener');\r\n\r\n/**\r\n * Remove event(s) from element(s).\r\n * @param elements DOM-Elements\r\n * @param events Event names\r\n * @param fn Callback\r\n * @param options Optional options\r\n * @return Array passed arguments\r\n */\r\nexport const off = eventListener.bind(null, 'removeEventListener');\r\n\r\nfunction eventListener(method, elements, events, fn, options = {}) {\r\n\r\n // Normalize array\r\n if (elements instanceof HTMLCollection || elements instanceof NodeList) {\r\n elements = Array.from(elements);\r\n } else if (!Array.isArray(elements)) {\r\n elements = [elements];\r\n }\r\n\r\n if (!Array.isArray(events)) {\r\n events = [events];\r\n }\r\n\r\n for (const el of elements) {\r\n for (const ev of events) {\r\n el[method](ev, fn, {capture: false, ...options});\r\n }\r\n }\r\n\r\n return Array.prototype.slice.call(arguments, 1);\r\n}\r\n\r\n/**\r\n * Creates an DOM-Element out of a string (Single element).\r\n * @param html HTML representing a single element\r\n * @returns {Element | null} The element.\r\n */\r\nexport function createElementFromString(html) {\r\n const div = document.createElement('div');\r\n div.innerHTML = html.trim();\r\n return div.firstElementChild;\r\n}\r\n\r\n/**\r\n * Removes an attribute from a HTMLElement and returns the value.\r\n * @param el\r\n * @param name\r\n * @return {string}\r\n */\r\nexport function removeAttribute(el, name) {\r\n const value = el.getAttribute(name);\r\n el.removeAttribute(name);\r\n return value;\r\n}\r\n\r\n/**\r\n * Creates a new html element, every element which has\r\n * a 'data-key' attribute will be saved in a object (which will be returned)\r\n * where the value of 'data-key' ist the object-key and the value the HTMLElement.\r\n *\r\n * It's possible to create a hierarchy if you add a 'data-con' attribute. Every\r\n * sibling will be added to the object which will get the name from the 'data-con' attribute.\r\n *\r\n * If you want to create an Array out of multiple elements, you can use the 'data-arr' attribute,\r\n * the value defines the key and all elements, which has the same parent and the same 'data-arr' attribute,\r\n * would be added to it.\r\n *\r\n * @param str - The HTML String.\r\n */\r\nexport function createFromTemplate(str) {\r\n\r\n // Recursive function to resolve template\r\n function resolve(element, base = {}) {\r\n\r\n // Check key and container attribute\r\n const con = removeAttribute(element, 'data-con');\r\n const key = removeAttribute(element, 'data-key');\r\n\r\n // Check and save element\r\n if (key) {\r\n base[key] = element;\r\n }\r\n\r\n // Check all children\r\n const subtree = con ? (base[con] = {}) : base;\r\n for (let child of Array.from(element.children)) {\r\n\r\n // Check if element should be saved as array\r\n const arr = removeAttribute(child, 'data-arr');\r\n if (arr) {\r\n\r\n // Check if there is already an array and add element\r\n (subtree[arr] || (subtree[arr] = [])).push(child);\r\n } else {\r\n resolve(child, subtree);\r\n }\r\n }\r\n\r\n return base;\r\n }\r\n\r\n return resolve(createElementFromString(str));\r\n}\r\n\r\n/**\r\n * Polyfill for safari & firefox for the eventPath event property.\r\n * @param evt The event object.\r\n * @return [String] event path.\r\n */\r\nexport function eventPath(evt) {\r\n let path = evt.path || (evt.composedPath && evt.composedPath());\r\n if (path) return path;\r\n\r\n let el = evt.target.parentElement;\r\n path = [evt.target, el];\r\n while (el = el.parentElement) path.push(el);\r\n\r\n path.push(document, window);\r\n return path;\r\n}\r\n\r\n/**\r\n * Creates the ability to change numbers in an input field with the scroll-wheel.\r\n * @param el\r\n * @param mapper\r\n */\r\nexport function adjustableInputNumbers(el, mapper = v => v) {\r\n\r\n function handleScroll(e) {\r\n const inc = ([0.001, 0.01, 0.1])[Number(e.shiftKey || e.ctrlKey * 2)] * (e.deltaY < 0 ? 1 : -1);\r\n\r\n let index = 0;\r\n let off = el.selectionStart;\r\n el.value = el.value.replace(/[\\d.]+/g, (v, i) => {\r\n\r\n // Check if number is in cursor range and increase it\r\n if (i <= off && i + v.length >= off) {\r\n off = i;\r\n return mapper(Number(v), inc, index);\r\n }\r\n\r\n index++;\r\n return v;\r\n });\r\n\r\n el.focus();\r\n el.setSelectionRange(off, off);\r\n\r\n // Prevent default and trigger input event\r\n e.preventDefault();\r\n el.dispatchEvent(new Event('input'));\r\n }\r\n\r\n // Bind events\r\n on(el, 'focus', () => on(window, 'wheel', handleScroll, {passive: false}));\r\n on(el, 'blur', () => off(window, 'wheel', handleScroll));\r\n}\r\n","// Shorthands\r\nconst {min, max, floor, round} = Math;\r\n\r\n/**\r\n * Tries to convert a color name to rgb/a hex representation\r\n * @param name\r\n * @returns {string | CanvasGradient | CanvasPattern}\r\n */\r\nfunction standardizeColor(name) {\r\n const ctx = document.createElement('canvas').getContext('2d');\r\n ctx.fillStyle = name;\r\n return ctx.fillStyle;\r\n}\r\n\r\n/**\r\n * Convert HSV spectrum to RGB.\r\n * @param h Hue\r\n * @param s Saturation\r\n * @param v Value\r\n * @returns {number[]} Array with rgb values.\r\n */\r\nexport function hsvToRgb(h, s, v) {\r\n h = (h / 360) * 6;\r\n s /= 100;\r\n v /= 100;\r\n\r\n let i = floor(h);\r\n\r\n let f = h - i;\r\n let p = v * (1 - s);\r\n let q = v * (1 - f * s);\r\n let t = v * (1 - (1 - f) * s);\r\n\r\n let mod = i % 6;\r\n let r = [v, q, p, p, t, v][mod];\r\n let g = [t, v, v, q, p, p][mod];\r\n let b = [p, p, t, v, v, q][mod];\r\n\r\n return [\r\n r * 255,\r\n g * 255,\r\n b * 255\r\n ];\r\n}\r\n\r\n/**\r\n * Convert HSV spectrum to Hex.\r\n * @param h Hue\r\n * @param s Saturation\r\n * @param v Value\r\n * @returns {string[]} Hex values\r\n */\r\nexport function hsvToHex(h, s, v) {\r\n return hsvToRgb(h, s, v).map(v =>\r\n round(v).toString(16).padStart(2, '0')\r\n );\r\n}\r\n\r\n/**\r\n * Convert HSV spectrum to CMYK.\r\n * @param h Hue\r\n * @param s Saturation\r\n * @param v Value\r\n * @returns {number[]} CMYK values\r\n */\r\nexport function hsvToCmyk(h, s, v) {\r\n const rgb = hsvToRgb(h, s, v);\r\n const r = rgb[0] / 255;\r\n const g = rgb[1] / 255;\r\n const b = rgb[2] / 255;\r\n\r\n let k, c, m, y;\r\n\r\n k = min(1 - r, 1 - g, 1 - b);\r\n\r\n c = k === 1 ? 0 : (1 - r - k) / (1 - k);\r\n m = k === 1 ? 0 : (1 - g - k) / (1 - k);\r\n y = k === 1 ? 0 : (1 - b - k) / (1 - k);\r\n\r\n return [\r\n c * 100,\r\n m * 100,\r\n y * 100,\r\n k * 100\r\n ];\r\n}\r\n\r\n/**\r\n * Convert HSV spectrum to HSL.\r\n * @param h Hue\r\n * @param s Saturation\r\n * @param v Value\r\n * @returns {number[]} HSL values\r\n */\r\nexport function hsvToHsl(h, s, v) {\r\n s /= 100, v /= 100;\r\n\r\n let l = (2 - s) * v / 2;\r\n\r\n if (l !== 0) {\r\n if (l === 1) {\r\n s = 0;\r\n } else if (l < 0.5) {\r\n s = s * v / (l * 2);\r\n } else {\r\n s = s * v / (2 - l * 2);\r\n }\r\n }\r\n\r\n return [\r\n h,\r\n s * 100,\r\n l * 100\r\n ];\r\n}\r\n\r\n/**\r\n * Convert RGB to HSV.\r\n * @param r Red\r\n * @param g Green\r\n * @param b Blue\r\n * @return {number[]} HSV values.\r\n */\r\nfunction rgbToHsv(r, g, b) {\r\n r /= 255, g /= 255, b /= 255;\r\n\r\n let h, s, v;\r\n const minVal = min(r, g, b);\r\n const maxVal = max(r, g, b);\r\n const delta = maxVal - minVal;\r\n\r\n v = maxVal;\r\n if (delta === 0) {\r\n h = s = 0;\r\n } else {\r\n s = delta / maxVal;\r\n let dr = (((maxVal - r) / 6) + (delta / 2)) / delta;\r\n let dg = (((maxVal - g) / 6) + (delta / 2)) / delta;\r\n let db = (((maxVal - b) / 6) + (delta / 2)) / delta;\r\n\r\n if (r === maxVal) {\r\n h = db - dg;\r\n } else if (g === maxVal) {\r\n h = (1 / 3) + dr - db;\r\n } else if (b === maxVal) {\r\n h = (2 / 3) + dg - dr;\r\n }\r\n\r\n if (h < 0) {\r\n h += 1;\r\n } else if (h > 1) {\r\n h -= 1;\r\n }\r\n }\r\n\r\n return [\r\n h * 360,\r\n s * 100,\r\n v * 100\r\n ];\r\n}\r\n\r\n/**\r\n * Convert CMYK to HSV.\r\n * @param c Cyan\r\n * @param m Magenta\r\n * @param y Yellow\r\n * @param k Key (Black)\r\n * @return {number[]} HSV values.\r\n */\r\nfunction cmykToHsv(c, m, y, k) {\r\n c /= 100, m /= 100, y /= 100, k /= 100;\r\n\r\n const r = (1 - min(1, c * (1 - k) + k)) * 255;\r\n const g = (1 - min(1, m * (1 - k) + k)) * 255;\r\n const b = (1 - min(1, y * (1 - k) + k)) * 255;\r\n\r\n return [...rgbToHsv(r, g, b)];\r\n}\r\n\r\n/**\r\n * Convert HSL to HSV.\r\n * @param h Hue\r\n * @param s Saturation\r\n * @param l Lightness\r\n * @return {number[]} HSV values.\r\n */\r\nfunction hslToHsv(h, s, l) {\r\n s /= 100, l /= 100;\r\n s *= l < 0.5 ? l : 1 - l;\r\n\r\n let ns = (2 * s / (l + s)) * 100;\r\n let v = (l + s) * 100;\r\n return [h, ns, v];\r\n}\r\n\r\n/**\r\n * Convert HEX to HSV.\r\n * @param hex Hexadecimal string of rgb colors, can have length 3 or 6.\r\n * @return {number[]} HSV values.\r\n */\r\nfunction hexToHsv(hex) {\r\n return rgbToHsv(...hex.match(/.{2}/g).map(v => parseInt(v, 16)));\r\n}\r\n\r\n/**\r\n * Try's to parse a string which represents a color to a HSV array.\r\n * Current supported types are cmyk, rgba, hsla and hexadecimal.\r\n * @param str\r\n * @return {*}\r\n */\r\nexport function parseToHSV(str) {\r\n\r\n // Check if string is a color-name\r\n str = str.match(/^[a-zA-Z]+$/) ? standardizeColor(str) : str;\r\n\r\n // Regular expressions to match different types of color represention\r\n const regex = {\r\n cmyk: /^cmyk[\\D]+(\\d+)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]+(\\d+)/i,\r\n rgba: /^(rgb|rgba)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]*?([\\d.]+|$)/i,\r\n hsla: /^(hsl|hsla)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]*?([\\d.]+|$)/i,\r\n hsva: /^(hsv|hsva)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]*?([\\d.]+|$)/i,\r\n hex: /^#?(([\\dA-Fa-f]{3,4})|([\\dA-Fa-f]{6})|([\\dA-Fa-f]{8}))$/i\r\n };\r\n\r\n /**\r\n * Takes an Array of any type, convert strings which represents\r\n * a number to a number an anything else to undefined.\r\n * @param array\r\n * @return {*}\r\n */\r\n const numarize = array => array.map(v => /^(|\\d+)\\.\\d+|\\d+$/.test(v) ? Number(v) : undefined);\r\n\r\n let match;\r\n for (const type in regex) {\r\n\r\n // Check if current scheme passed\r\n if (!(match = regex[type].exec(str)))\r\n continue;\r\n\r\n // Try to convert\r\n switch (type) {\r\n case 'cmyk': {\r\n let [, c, m, y, k] = numarize(match);\r\n\r\n if (c > 100 || m > 100 || y > 100 || k > 100)\r\n break;\r\n\r\n return {values: [...cmykToHsv(c, m, y, k), 1], type};\r\n }\r\n case 'rgba': {\r\n let [, , r, g, b, a = 1] = numarize(match);\r\n\r\n if (r > 255 || g > 255 || b > 255 || a < 0 || a > 1)\r\n break;\r\n\r\n return {values: [...rgbToHsv(r, g, b), a], type};\r\n }\r\n case 'hex': {\r\n const splitAt = (s, i) => [s.substring(0, i), s.substring(i, s.length)];\r\n let [, hex] = match;\r\n\r\n // Fill up opacity if not declared\r\n if (hex.length === 3) {\r\n hex += 'F';\r\n } else if (hex.length === 6) {\r\n hex += 'FF';\r\n }\r\n\r\n let alpha;\r\n if (hex.length === 4) {\r\n [hex, alpha] = splitAt(hex, 3).map(v => v + v);\r\n } else if (hex.length === 8) {\r\n [hex, alpha] = splitAt(hex, 6);\r\n }\r\n\r\n // Convert 0 - 255 to 0 - 1 for opacity\r\n alpha = parseInt(alpha, 16) / 255;\r\n return {values: [...hexToHsv(hex), alpha], type};\r\n }\r\n case 'hsla': {\r\n let [, , h, s, l, a = 1] = numarize(match);\r\n\r\n if (h > 360 || s > 100 || l > 100 || a < 0 || a > 1)\r\n break;\r\n\r\n return {values: [...hslToHsv(h, s, l), a], type};\r\n }\r\n case 'hsva': {\r\n let [, , h, s, v, a = 1] = numarize(match);\r\n\r\n if (h > 360 || s > 100 || v > 100 || a < 0 || a > 1)\r\n break;\r\n\r\n return {values: [h, s, v, a], type};\r\n }\r\n }\r\n }\r\n\r\n return {values: null, type: null};\r\n}\r\n","import {hsvToHsl, hsvToRgb, hsvToCmyk, hsvToHex} from './color';\r\n\r\n/**\r\n * Simple class which holds the properties\r\n * of the color represention model hsla (hue saturation lightness alpha)\r\n */\r\nexport function HSVaColor(h = 0, s = 0, v = 0, a = 1) {\r\n const {ceil} = Math;\r\n\r\n const that = {\r\n h, s, v, a,\r\n\r\n toHSVA() {\r\n const hsva = [that.h, that.s, that.v];\r\n const rhsva = hsva.map(ceil);\r\n\r\n hsva.push(that.a);\r\n hsva.toString = () => `hsva(${rhsva[0]}, ${rhsva[1]}%, ${rhsva[2]}%, ${that.a.toFixed(1)})`;\r\n return hsva;\r\n },\r\n\r\n toHSLA() {\r\n const hsla = hsvToHsl(that.h, that.s, that.v);\r\n const rhsla = hsla.map(ceil);\r\n\r\n hsla.push(that.a);\r\n hsla.toString = () => `hsla(${rhsla[0]}, ${rhsla[1]}%, ${rhsla[2]}%, ${that.a.toFixed(1)})`;\r\n return hsla;\r\n },\r\n\r\n toRGBA() {\r\n const rgba = hsvToRgb(that.h, that.s, that.v);\r\n const rrgba = rgba.map(ceil);\r\n\r\n rgba.push(that.a);\r\n rgba.toString = () => `rgba(${rrgba[0]}, ${rrgba[1]}, ${rrgba[2]}, ${that.a.toFixed(1)})`;\r\n return rgba;\r\n },\r\n\r\n toCMYK() {\r\n const cmyk = hsvToCmyk(that.h, that.s, that.v);\r\n const rcmyk = cmyk.map(ceil);\r\n\r\n cmyk.toString = () => `cmyk(${rcmyk[0]}%, ${rcmyk[1]}%, ${rcmyk[2]}%, ${rcmyk[3]}%)`;\r\n return cmyk;\r\n },\r\n\r\n toHEXA() {\r\n const hex = hsvToHex(that.h, that.s, that.v);\r\n\r\n hex.toString = () => {\r\n\r\n // Check if alpha channel make sense, convert it to 255 number space, convert\r\n // to hex and pad it with zeros if needet.\r\n const alpha = that.a >= 1 ? '' : Number((that.a * 255).toFixed(0))\r\n .toString(16)\r\n .toUpperCase().padStart(2, '0');\r\n\r\n return `#${hex.join('').toUpperCase() + alpha}`;\r\n };\r\n\r\n return hex;\r\n },\r\n\r\n clone() {\r\n return HSVaColor(that.h, that.s, that.v, that.a);\r\n }\r\n };\r\n\r\n return that;\r\n}\r\n","import * as _ from '../utils/utils';\r\n\r\nconst clamp = v => Math.max(Math.min(v, 1), 0);\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 lock: null,\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: {lock}, cache} = that;\r\n const {element, wrapper} = options;\r\n const b = 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 (lock !== 'h') {\r\n element.style.left = `calc(${x / b.width * 100}% - ${element.offsetWidth / 2}px)`;\r\n }\r\n\r\n if (lock !== 'v') {\r\n element.style.top = `calc(${y / b.height * 100}% - ${element.offsetHeight / 2}px)`;\r\n }\r\n\r\n that.cache = {x: x / b.width, y: y / b.height};\r\n const cx = clamp(x / wrapper.offsetWidth);\r\n const cy = clamp(y / wrapper.offsetHeight);\r\n\r\n switch (lock) {\r\n case 'v':\r\n return options.onchange(cx);\r\n case 'h':\r\n return options.onchange(cy);\r\n default:\r\n return options.onchange(cx, cy);\r\n }\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 {left, top, width, height} = that.options.wrapper.getBoundingClientRect();\r\n that._tapmove({\r\n clientX: left + width * x,\r\n clientY: top + height * 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 '../utils/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 * as _ from './utils/utils';\r\n\r\nexport default ({components: c, strings: s, useAsButton, inline, appClass}) => {\r\n const hidden = con => con ? '' : 'style=\"display:none\" hidden';\r\n\r\n const root = _.createFromTemplate(`\r\n
\r\n\r\n ${useAsButton ? '' : ''}\r\n\r\n
\r\n
\r\n
\r\n \r\n
\r\n
\r\n\r\n
\r\n
\r\n
\r\n
\r\n\r\n
\r\n
\r\n
\r\n
\r\n\r\n
\r\n
\r\n
\r\n
\r\n
\r\n\r\n
\r\n\r\n
\r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n
\r\n
\r\n
\r\n `);\r\n\r\n const int = root.interaction;\r\n\r\n // Select option which is not hidden\r\n int.options.find(o => !o.hidden && !o.classList.add('active'));\r\n\r\n // Create method to find currenlty active option\r\n int.type = () => int.options.find(e => e.classList.contains('active'));\r\n return root;\r\n}\r\n","\r\n// Import utils\r\nimport * as _ from './utils/utils';\r\nimport * as Color from './utils/color';\r\n\r\n// Import classes\r\nimport {HSVaColor} from './utils/hsvacolor';\r\nimport Moveable from './libs/moveable';\r\nimport Selectable from './libs/selectable';\r\nimport Nanopop from './libs/nanopop';\r\nimport buildPickr from './template';\r\n\r\nclass Pickr {\r\n\r\n // Will be used to prevent specific actions during initilization\r\n _initializingActive = true;\r\n\r\n // Replace element with color picker\r\n _recalc = true;\r\n\r\n // Current and last color for comparison\r\n _color = HSVaColor();\r\n _lastColor = HSVaColor();\r\n _swatchColors = [];\r\n\r\n // Evenlistener name: [callbacks]\r\n _eventListener = {\r\n 'swatchselect': [],\r\n 'change': [],\r\n 'save': [],\r\n 'init': []\r\n };\r\n\r\n constructor(opt) {\r\n\r\n // Assign default values\r\n this.options = opt = Object.assign({\r\n appClass: null,\r\n useAsButton: false,\r\n disabled: false,\r\n comparison: true,\r\n\r\n components: {\r\n interaction: {}\r\n },\r\n\r\n strings: {},\r\n swatches: null,\r\n inline: false,\r\n sliders: 'v',\r\n\r\n default: '#42445A',\r\n defaultRepresentation: null,\r\n position: 'bottom-middle',\r\n adjustableNumbers: true,\r\n showAlways: false,\r\n\r\n closeWithKey: 'Escape'\r\n }, opt);\r\n\r\n const {swatches, inline, components, position} = opt;\r\n\r\n // Check interaction section\r\n if (!components.interaction) {\r\n components.interaction = {};\r\n }\r\n\r\n // Overwrite palette if preview, opacity or hue are true\r\n const {preview, opacity, hue, palette} = components;\r\n components.palette = palette || preview || opacity || hue;\r\n\r\n // Per default enabled if inline\r\n if (inline) {\r\n opt.showAlways = true;\r\n }\r\n\r\n // Initialize picker\r\n this._preBuild();\r\n this._buildComponents();\r\n this._bindEvents();\r\n\r\n // Finalize build\r\n this._finalBuild();\r\n\r\n // Append pre-defined swatch colors\r\n if (swatches && swatches.length) {\r\n swatches.forEach(color => this.addSwatch(color));\r\n }\r\n\r\n // Initialize positioning engine\r\n this._nanopop = Nanopop({\r\n reference: this._root.button,\r\n el: this._root.app,\r\n pos: position\r\n });\r\n\r\n // Initilization is finish, pickr is visible and ready for usage\r\n const {button} = this._root;\r\n const that = this;\r\n requestAnimationFrame((function cb() {\r\n\r\n // offsetParent of body is always 0. So check if it is the body\r\n if (button.offsetParent === null && button !== document.body) {\r\n return requestAnimationFrame(cb);\r\n }\r\n\r\n // Apply default color\r\n that.setColor(opt.default);\r\n that._rePositioningPicker();\r\n\r\n // Initialize color representation\r\n if (opt.defaultRepresentation) {\r\n that._representation = opt.defaultRepresentation;\r\n that.setColorRepresentation(that._representation);\r\n }\r\n\r\n // Show pickr if locked\r\n if (opt.showAlways) {\r\n that.show();\r\n }\r\n\r\n // Initialization is done - pickr is usable, fire init event\r\n that._initializingActive = false;\r\n that._emit('init');\r\n }));\r\n }\r\n\r\n // Does only the absolutly basic thing to initialize the components\r\n _preBuild() {\r\n const opt = this.options;\r\n\r\n // Check if element is selector\r\n if (typeof opt.el === 'string') {\r\n\r\n // Resolve possible shadow dom access\r\n opt.el = opt.el.split(/>>/g).reduce((pv, cv, ci, a) => {\r\n pv = pv.querySelector(cv);\r\n return ci < a.length - 1 ? pv.shadowRoot : pv;\r\n }, document);\r\n }\r\n\r\n // Create element and append it to body to\r\n // prevent initialization errors\r\n this._root = buildPickr(opt);\r\n\r\n // Check if a custom button is used\r\n if (opt.useAsButton) {\r\n this._root.button = opt.el; // Replace button with customized button\r\n }\r\n\r\n document.body.appendChild(this._root.root);\r\n }\r\n\r\n _finalBuild() {\r\n const opt = this.options;\r\n const root = this._root;\r\n\r\n // Remove from body\r\n document.body.removeChild(root.root);\r\n\r\n if (opt.inline) {\r\n const {parentElement} = opt.el;\r\n\r\n if (parentElement.lastChild === opt.el) {\r\n parentElement.appendChild(root.app);\r\n } else {\r\n parentElement.insertBefore(root.app, opt.el.nextSibling);\r\n }\r\n } else {\r\n document.body.appendChild(root.app);\r\n }\r\n\r\n // Don't replace the the element if a custom button is used\r\n if (!opt.useAsButton) {\r\n\r\n // Replace element with actual color-picker\r\n opt.el.parentNode.replaceChild(root.root, opt.el);\r\n }\r\n\r\n // Call disable to also add the disabled class\r\n if (opt.disabled) {\r\n this.disable();\r\n }\r\n\r\n // Check if color comparison is disabled, if yes - remove transitions so everything keeps smoothly\r\n if (!opt.comparison) {\r\n root.button.style.transition = 'none';\r\n if (!opt.useAsButton) {\r\n root.preview.lastColor.style.transition = 'none';\r\n }\r\n }\r\n\r\n this.hide();\r\n }\r\n\r\n _buildComponents() {\r\n\r\n // Instance reference\r\n const inst = this;\r\n const comp = this.options.components;\r\n const [so, sh] = (() => {\r\n const {sliders} = inst.options;\r\n let so = 'v', sh = 'v';\r\n\r\n if (sliders.match(/^[vh]+$/g)) {\r\n if (sliders.length > 1) {\r\n [so, sh] = sliders;\r\n } else {\r\n so = sh = sliders;\r\n }\r\n }\r\n\r\n const opposite = {v: 'h', h: 'v'};\r\n return [opposite[so], opposite[sh]];\r\n })();\r\n\r\n const components = {\r\n\r\n palette: Moveable({\r\n element: inst._root.palette.picker,\r\n wrapper: inst._root.palette.palette,\r\n\r\n onchange(x, y) {\r\n if (!comp.palette) return;\r\n const {_color, _root, options} = inst;\r\n\r\n // Calculate saturation based on the position\r\n _color.s = x * 100;\r\n\r\n // Calculate the value\r\n _color.v = 100 - y * 100;\r\n\r\n // Prevent falling under zero\r\n _color.v < 0 ? _color.v = 0 : 0;\r\n\r\n // Set picker and gradient color\r\n const cssRGBaString = _color.toRGBA().toString();\r\n this.element.style.background = cssRGBaString;\r\n this.wrapper.style.background = `\r\n linear-gradient(to top, rgba(0, 0, 0, ${_color.a}), transparent),\r\n linear-gradient(to left, hsla(${_color.h}, 100%, 50%, ${_color.a}), rgba(255, 255, 255, ${_color.a}))\r\n `;\r\n\r\n // Check if color is locked\r\n if (!options.comparison) {\r\n _root.button.style.color = cssRGBaString;\r\n\r\n if (!options.useAsButton) {\r\n _root.preview.lastColor.style.color = cssRGBaString;\r\n }\r\n }\r\n\r\n // Change current color\r\n _root.preview.currentColor.style.color = cssRGBaString;\r\n\r\n // Update the input field only if the user is currently not typing\r\n if (inst._recalc) {\r\n inst._updateOutput();\r\n }\r\n\r\n if (!inst.options.comparison) {\r\n\r\n // If the user changes the color, remove the cleared icon\r\n _root.button.classList.remove('clear');\r\n }\r\n }\r\n }),\r\n\r\n hue: Moveable({\r\n lock: sh,\r\n element: inst._root.hue.picker,\r\n wrapper: inst._root.hue.slider,\r\n\r\n onchange(v) {\r\n if (!comp.hue || !comp.palette) return;\r\n\r\n // Calculate hue\r\n inst._color.h = v * 360;\r\n\r\n // Update color\r\n this.element.style.backgroundColor = `hsl(${inst._color.h}, 100%, 50%)`;\r\n components.palette.trigger();\r\n }\r\n }),\r\n\r\n opacity: Moveable({\r\n lock: so,\r\n element: inst._root.opacity.picker,\r\n wrapper: inst._root.opacity.slider,\r\n\r\n onchange(v) {\r\n if (!comp.opacity || !comp.palette) return;\r\n\r\n // Calculate opacity\r\n inst._color.a = Math.round(v * 1e2) / 100;\r\n\r\n // Update color\r\n this.element.style.background = `rgba(0, 0, 0, ${inst._color.a})`;\r\n inst.components.palette.trigger();\r\n }\r\n }),\r\n\r\n selectable: Selectable({\r\n elements: inst._root.interaction.options,\r\n className: 'active',\r\n onchange(e) {\r\n inst._representation = e.target.getAttribute('data-type').toUpperCase();\r\n inst._updateOutput();\r\n }\r\n })\r\n };\r\n\r\n this.components = components;\r\n }\r\n\r\n _bindEvents() {\r\n const {_root, options} = this;\r\n\r\n const eventBindings = [\r\n\r\n // Clear color\r\n _.on(_root.interaction.clear, 'click', () => this._clearColor()),\r\n\r\n // Select last color on click\r\n _.on(_root.preview.lastColor, 'click', () => this.setHSVA(...this._lastColor.toHSVA())),\r\n\r\n // Save color\r\n _.on(_root.interaction.save, 'click', () => {\r\n !this.applyColor() && !options.showAlways && this.hide();\r\n }),\r\n\r\n // Detect user input and disable auto-recalculation\r\n _.on(_root.interaction.result, ['keyup', 'input'], e => {\r\n this._recalc = false;\r\n\r\n // Fire listener if initialization is finish and changed color was valid\r\n if (this.setColor(e.target.value, true) && !this._initializingActive) {\r\n this._emit('change', this._color);\r\n }\r\n\r\n e.stopImmediatePropagation();\r\n }),\r\n\r\n // Cancel input detection on color change\r\n _.on([\r\n _root.palette.palette,\r\n _root.palette.picker,\r\n _root.hue.slider,\r\n _root.hue.picker,\r\n _root.opacity.slider,\r\n _root.opacity.picker\r\n ], ['mousedown', 'touchstart'], () => this._recalc = true)\r\n ];\r\n\r\n // Provide hiding / showing abilities only if showAlways is false\r\n if (!options.showAlways) {\r\n const ck = options.closeWithKey;\r\n\r\n eventBindings.push(\r\n // Save and hide / show picker\r\n _.on(_root.button, 'click', () => this.isOpen() ? this.hide() : this.show()),\r\n\r\n // Close with escape key\r\n _.on(document, 'keyup', e => this.isOpen() && (e.key === ck || e.code === ck) && this.hide()),\r\n\r\n // Cancel selecting if the user taps behind the color picker\r\n _.on(document, ['touchstart', 'mousedown'], e => {\r\n if (this.isOpen() && !_.eventPath(e).some(el => el === _root.app || el === _root.button)) {\r\n this.hide();\r\n }\r\n }, {capture: true})\r\n );\r\n }\r\n\r\n // Make input adjustable if enabled\r\n if (options.adjustableNumbers) {\r\n const ranges = {\r\n rgba: [255, 255, 255, 1],\r\n hsva: [360, 100, 100, 1],\r\n hsla: [360, 100, 100, 1],\r\n cmyk: [100, 100, 100, 100]\r\n };\r\n\r\n _.adjustableInputNumbers(_root.interaction.result, (o, step, index) => {\r\n const range = ranges[this.getColorRepresentation().toLowerCase()];\r\n\r\n if (range) {\r\n const max = range[index];\r\n\r\n // Calculate next reasonable number\r\n const nv = o + (max >= 100 ? step * 1000 : step);\r\n\r\n // Apply range of zero up to max, fix floating-point issues\r\n return nv <= 0 ? 0 : Number((nv < max ? nv : max).toPrecision(3));\r\n } else {\r\n return o;\r\n }\r\n });\r\n }\r\n\r\n if (!options.inline) {\r\n let timeout = null;\r\n const that = this;\r\n\r\n // Re-calc position on window resize, scroll and wheel\r\n eventBindings.push(\r\n _.on(window, ['scroll', 'resize'], () => {\r\n if (that.isOpen()) {\r\n if (timeout === null) {\r\n timeout = setTimeout(() => timeout = null, 100);\r\n\r\n // Update position on every frame\r\n requestAnimationFrame(function rs() {\r\n that._rePositioningPicker();\r\n (timeout !== null) && requestAnimationFrame(rs);\r\n });\r\n } else {\r\n clearTimeout(timeout);\r\n timeout = setTimeout(() => timeout = null, 100);\r\n }\r\n }\r\n })\r\n );\r\n }\r\n\r\n // Save bindings\r\n this._eventBindings = eventBindings;\r\n }\r\n\r\n _rePositioningPicker() {\r\n\r\n // No repositioning needed if inline\r\n if (!this.options.inline) {\r\n this._nanopop.update();\r\n }\r\n }\r\n\r\n _updateOutput() {\r\n\r\n // Check if component is present\r\n if (this._root.interaction.type()) {\r\n\r\n // Construct function name and call if present\r\n const method = `to${this._root.interaction.type().getAttribute('data-type')}`;\r\n this._root.interaction.result.value = typeof this._color[method] === 'function' ? this._color[method]().toString() : '';\r\n }\r\n\r\n // Fire listener if initialization is finish\r\n if (!this._initializingActive) {\r\n this._emit('change', this._color);\r\n }\r\n }\r\n\r\n _clearColor() {\r\n const {_root, options} = this;\r\n\r\n // Change only the button color if it isn't customized\r\n if (!options.useAsButton) {\r\n _root.button.style.color = 'rgba(0, 0, 0, 0.15)';\r\n }\r\n\r\n _root.button.classList.add('clear');\r\n\r\n if (!options.showAlways) {\r\n this.hide();\r\n }\r\n\r\n if (!this._initializingActive) {\r\n\r\n // Fire listener\r\n this._emit('save', null);\r\n }\r\n }\r\n\r\n _emit(event, ...args) {\r\n this._eventListener[event].forEach(cb => cb(...args, this));\r\n }\r\n\r\n on(event, cb) {\r\n\r\n // Validate\r\n if (typeof cb === 'function' && typeof event === 'string' && event in this._eventListener) {\r\n this._eventListener[event].push(cb);\r\n }\r\n\r\n return this;\r\n }\r\n\r\n off(event, cb) {\r\n const callBacks = this._eventListener[event];\r\n\r\n if (callBacks) {\r\n const index = callBacks.indexOf(cb);\r\n\r\n if (~index) {\r\n callBacks.splice(index, 1);\r\n }\r\n }\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Appends a color to the swatch palette\r\n * @param color\r\n * @returns {boolean}\r\n */\r\n addSwatch(color) {\r\n const {values} = Color.parseToHSV(color);\r\n\r\n if (values) {\r\n const {_swatchColors, _root} = this;\r\n const hsvaColorObject = HSVaColor(...values);\r\n\r\n // Create new swatch HTMLElement\r\n const element = _.createElementFromString(\r\n ``\r\n );\r\n\r\n // Append element and save swatch data\r\n _root.swatches.appendChild(element);\r\n _swatchColors.push({element, hsvaColorObject});\r\n\r\n // Bind event\r\n this._eventBindings.push(\r\n _.on(element, 'click', () => {\r\n this.setHSVA(...hsvaColorObject.toHSVA(), true);\r\n this._emit('swatchselect', hsvaColorObject);\r\n })\r\n );\r\n\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n /**\r\n * Removes a swatch color by it's index\r\n * @param index\r\n * @returns {boolean}\r\n */\r\n removeSwatch(index) {\r\n\r\n // Validate index\r\n if (typeof index === 'number') {\r\n const swatchColor = this._swatchColors[index];\r\n\r\n // Check swatch data\r\n if (swatchColor) {\r\n const {element} = swatchColor;\r\n\r\n // Remove HTML child and swatch data\r\n this._root.swatches.removeChild(element);\r\n this._swatchColors.splice(index, 1);\r\n return true;\r\n }\r\n }\r\n\r\n return false;\r\n }\r\n\r\n applyColor(silent = false) {\r\n const {preview, button} = this._root;\r\n\r\n // Change preview and current color\r\n const cssRGBaString = this._color.toRGBA().toString();\r\n preview.lastColor.style.color = cssRGBaString;\r\n\r\n // Change only the button color if it isn't customized\r\n if (!this.options.useAsButton) {\r\n button.style.color = cssRGBaString;\r\n }\r\n\r\n // User changed the color so remove the clear clas\r\n button.classList.remove('clear');\r\n\r\n // Save last color\r\n this._lastColor = this._color.clone();\r\n\r\n // Fire listener\r\n if (!this._initializingActive && !silent) {\r\n this._emit('save', this._color);\r\n }\r\n }\r\n\r\n /**\r\n * Destroy's all functionalitys\r\n */\r\n destroy() {\r\n this._eventBindings.forEach(args => _.off(...args));\r\n Object.keys(this.components).forEach(key => this.components[key].destroy());\r\n }\r\n\r\n /**\r\n * Destroy's all functionalitys and removes\r\n * the pickr element.\r\n */\r\n destroyAndRemove() {\r\n this.destroy();\r\n\r\n // Remove element\r\n const root = this._root.root;\r\n root.parentElement.removeChild(root);\r\n\r\n // remove .pcr-app\r\n const app = this._root.app;\r\n app.parentElement.removeChild(app);\r\n\r\n // There are references to various DOM elements stored in the pickr instance\r\n // This cleans all of them to avoid detached DOMs\r\n const pickr = this;\r\n Object.keys(pickr).forEach(key => pickr[key] = null);\r\n }\r\n\r\n /**\r\n * Hides the color-picker ui.\r\n */\r\n hide() {\r\n this._root.app.classList.remove('visible');\r\n return this;\r\n }\r\n\r\n /**\r\n * Shows the color-picker ui.\r\n */\r\n show() {\r\n if (this.options.disabled) return;\r\n this._root.app.classList.add('visible');\r\n this._rePositioningPicker();\r\n return this;\r\n }\r\n\r\n /**\r\n * @return {boolean} If the color picker is currently open\r\n */\r\n isOpen() {\r\n return this._root.app.classList.contains('visible');\r\n }\r\n\r\n /**\r\n * Set a specific color.\r\n * @param h Hue\r\n * @param s Saturation\r\n * @param v Value\r\n * @param a Alpha channel (0 - 1)\r\n * @param silent If the button should not change the color\r\n * @return boolean if the color has been accepted\r\n */\r\n setHSVA(h = 360, s = 0, v = 0, a = 1, silent = false) {\r\n\r\n // Deactivate color calculation\r\n const recalc = this._recalc; // Save state\r\n this._recalc = false;\r\n\r\n // Validate input\r\n if (h < 0 || h > 360 || s < 0 || s > 100 || v < 0 || v > 100 || a < 0 || a > 1) {\r\n return false;\r\n }\r\n\r\n // Override current color and re-active color calculation\r\n this._color = HSVaColor(h, s, v, a);\r\n\r\n // Update slider and palette\r\n const {hue, opacity, palette} = this.components;\r\n hue.update(0, (h / 360));\r\n opacity.update(0, a);\r\n palette.update(s / 100, 1 - (v / 100));\r\n\r\n // Restore old state\r\n this._recalc = recalc;\r\n\r\n // Update output if recalculation is enabled\r\n if (this._recalc) {\r\n this._updateOutput();\r\n }\r\n\r\n // Check if call is silent\r\n if (!silent) {\r\n this.applyColor();\r\n }\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * Tries to parse a string which represents a color.\r\n * Examples: #fff\r\n * rgb 10 10 200\r\n * hsva 10 20 5 0.5\r\n * @param string\r\n * @param silent\r\n */\r\n setColor(string, silent = false) {\r\n\r\n // Check if null\r\n if (string === null) {\r\n this._clearColor();\r\n return true;\r\n }\r\n\r\n const {values, type} = Color.parseToHSV(string);\r\n\r\n // Check if color is ok\r\n if (values) {\r\n\r\n // Change selected color format\r\n const utype = type.toUpperCase();\r\n const {options} = this._root.interaction;\r\n const target = options.find(el => el.getAttribute('data-type').startsWith(utype));\r\n\r\n // Auto select only if not hidden\r\n if (target && !target.hidden) {\r\n for (const el of options) {\r\n el.classList[el === target ? 'add' : 'remove']('active');\r\n }\r\n }\r\n\r\n return this.setHSVA(...values, silent);\r\n }\r\n }\r\n\r\n /**\r\n * Changes the color _representation.\r\n * Allowed values are HEX, RGB, HSV, HSL and CMYK\r\n * @param type\r\n * @returns {boolean} if the selected type was valid.\r\n */\r\n setColorRepresentation(type) {\r\n\r\n // Force uppercase to allow a case-sensitiv comparison\r\n type = type.toUpperCase();\r\n\r\n // Find button with given type and trigger click event\r\n return !!this._root.interaction.options.find(v => v.getAttribute('data-type').startsWith(type) && !v.click());\r\n }\r\n\r\n /**\r\n * Returns the current color representaion. See setColorRepresentation\r\n * @returns {*}\r\n */\r\n getColorRepresentation() {\r\n return this._representation;\r\n }\r\n\r\n /**\r\n * @returns HSVaColor Current HSVaColor object.\r\n */\r\n getColor() {\r\n return this._color;\r\n }\r\n\r\n /**\r\n * @returns The root HTMLElement with all his components.\r\n */\r\n getRoot() {\r\n return this._root;\r\n }\r\n\r\n /**\r\n * Disable pickr\r\n */\r\n disable() {\r\n this.hide();\r\n this.options.disabled = true;\r\n this._root.button.classList.add('disabled');\r\n return this;\r\n }\r\n\r\n /**\r\n * Enable pickr\r\n */\r\n enable() {\r\n this.options.disabled = false;\r\n this._root.button.classList.remove('disabled');\r\n return this;\r\n }\r\n}\r\n\r\n// Expose pickr utils\r\nPickr.utils = _;\r\n\r\n// Create instance via method\r\nPickr.create = options => new Pickr(options);\r\n\r\n// Assign version and export\r\nPickr.version = '0.6.4';\r\nexport default Pickr;\r\n","/**\r\n * Micro positioning-engine\r\n * @param el\r\n * @param reference\r\n * @param pos\r\n * @param padding\r\n * @returns {{update(): void}}\r\n * @constructor\r\n */\r\nexport default function Nanopop({el, reference, pos, padding = 8}) {\r\n const vBehaviour = {start: 'sme', middle: 'mse', end: 'ems'};\r\n const hBehaviour = {top: 'tb', right: 'rl', bottom: 'bt', left: 'lr'};\r\n const [position, variant = 'middle'] = pos.split('-');\r\n const isVertical = (position === 'top' || position === 'bottom');\r\n\r\n return {\r\n update() {\r\n const rb = reference.getBoundingClientRect();\r\n const eb = el.getBoundingClientRect();\r\n\r\n const positions = isVertical ? {\r\n t: rb.top - eb.height - padding,\r\n b: rb.bottom + padding\r\n } : {\r\n r: rb.right + padding,\r\n l: rb.left - eb.width - padding\r\n };\r\n\r\n const variants = isVertical ? {\r\n s: rb.left + rb.width - eb.width,\r\n m: (-eb.width / 2) + (rb.left + rb.width / 2),\r\n e: rb.left\r\n } : {\r\n s: rb.bottom - eb.height,\r\n m: rb.bottom - rb.height / 2 - eb.height / 2,\r\n e: rb.bottom - rb.height\r\n };\r\n\r\n function apply(bevs, vars, styleprop) {\r\n const vertical = styleprop === 'top';\r\n const adder = vertical ? eb.height : eb.width;\r\n const win = window[vertical ? 'innerHeight' : 'innerWidth'];\r\n\r\n for (const ch of bevs) {\r\n const v = vars[ch];\r\n if (v > 0 && (v + adder) < win) {\r\n el.style[styleprop] = `${v}px`;\r\n break;\r\n }\r\n }\r\n }\r\n\r\n apply(vBehaviour[variant], variants, isVertical ? 'left' : 'top');\r\n apply(hBehaviour[position], positions, isVertical ? 'top' : 'left');\r\n }\r\n };\r\n}\r\n"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap","webpack:///./src/js/utils/utils.js","webpack:///./src/js/utils/color.js","webpack:///./src/js/utils/hsvacolor.js","webpack:///./src/js/libs/moveable.js","webpack:///./src/js/libs/selectable.js","webpack:///./src/js/template.js","webpack:///./src/js/pickr.js","webpack:///./src/js/libs/nanopop.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","HTMLCollection","NodeList","Array","from","isArray","el","ev","_objectSpread","capture","slice","arguments","createElementFromString","html","div","document","createElement","innerHTML","trim","firstElementChild","removeAttribute","getAttribute","createFromTemplate","str","resolve","element","base","con","subtree","child","children","arr","push","eventPath","evt","path","composedPath","target","parentElement","adjustableInputNumbers","mapper","v","handleScroll","e","inc","Number","shiftKey","ctrlKey","deltaY","index","selectionStart","replace","length","focus","setSelectionRange","preventDefault","dispatchEvent","Event","passive","min","max","floor","round","Math","hsvToRgb","h","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","undefined","type","exec","values","a","splitAt","substring","alpha","HSVaColor","ceil","that","toHSVA","rhsva","toString","concat","toFixed","toHSLA","hsvToHsl","rhsla","toRGBA","rrgba","toCMYK","rgb","hsvToCmyk","rcmyk","toHEXA","padStart","hsvToHex","toUpperCase","join","clone","clamp","Moveable","opt","assign","lock","onchange","_tapstart","_","_tapstop","_tapmove","cache","wrapper","getBoundingClientRect","x","touch","touches","clientX","clientY","left","width","top","height","style","offsetWidth","offsetHeight","cx","cy","trigger","update","destroy","Selectable","className","onTap","forEach","classList","template","components","strings","useAsButton","inline","appClass","hidden","palette","preview","hue","opacity","keys","interaction","input","save","clear","int","find","add","contains","Pickr","constructor","pickr_defineProperty","this","swatchselect","change","init","disabled","comparison","swatches","sliders","default","defaultRepresentation","position","adjustableNumbers","showAlways","closeWithKey","_preBuild","_buildComponents","_bindEvents","_finalBuild","color","addSwatch","_nanopop","reference","padding","vBehaviour","start","middle","end","hBehaviour","right","bottom","getInfo","pos","cached","variant","split","isVertical","rb","eb","positions","variants","apply","bevs","vars","styleprop","vertical","adder","win","ch","v1Ok","v2Ok","margin","Nanopop","_root","button","app","requestAnimationFrame","cb","offsetParent","body","setColor","_rePositioningPicker","_representation","setColorRepresentation","show","_initializingActive","_emit","reduce","pv","cv","ci","querySelector","shadowRoot","buildPickr","appendChild","removeChild","lastChild","insertBefore","nextSibling","parentNode","replaceChild","disable","transition","lastColor","hide","inst","comp","so","sh","opposite","picker","_color","cssRGBaString","background","currentColor","_recalc","_updateOutput","remove","slider","backgroundColor","selectable","eventBindings","_clearColor","setHSVA","_lastColor","applyColor","result","stopImmediatePropagation","ck","isOpen","code","some","ranges","step","range","getColorRepresentation","toLowerCase","nv","toPrecision","timeout","setTimeout","rs","clearTimeout","_eventBindings","event","args","_eventListener","callBacks","indexOf","splice","Color","_swatchColors","hsvaColorObject","removeSwatch","swatchColor","silent","destroyAndRemove","pickr","recalc","string","utype","startsWith","click","getColor","getRoot","enable","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,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,EAG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AAM3M,OAASiB,GAAW,IAAI0L,EAAM1L,GAGpC0L,EAAMqJ,QAAU,QACDrJ","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 = 0);\n","/**\r\n * Add event(s) to element(s).\r\n * @param elements DOM-Elements\r\n * @param events Event names\r\n * @param fn Callback\r\n * @param options Optional options\r\n * @return Array passed arguments\r\n */\r\nexport const on = eventListener.bind(null, 'addEventListener');\r\n\r\n/**\r\n * Remove event(s) from element(s).\r\n * @param elements DOM-Elements\r\n * @param events Event names\r\n * @param fn Callback\r\n * @param options Optional options\r\n * @return Array passed arguments\r\n */\r\nexport const off = eventListener.bind(null, 'removeEventListener');\r\n\r\nfunction eventListener(method, elements, events, fn, options = {}) {\r\n\r\n // Normalize array\r\n if (elements instanceof HTMLCollection || elements instanceof NodeList) {\r\n elements = Array.from(elements);\r\n } else if (!Array.isArray(elements)) {\r\n elements = [elements];\r\n }\r\n\r\n if (!Array.isArray(events)) {\r\n events = [events];\r\n }\r\n\r\n for (const el of elements) {\r\n for (const ev of events) {\r\n el[method](ev, fn, {capture: false, ...options});\r\n }\r\n }\r\n\r\n return Array.prototype.slice.call(arguments, 1);\r\n}\r\n\r\n/**\r\n * Creates an DOM-Element out of a string (Single element).\r\n * @param html HTML representing a single element\r\n * @returns {Element | null} The element.\r\n */\r\nexport function createElementFromString(html) {\r\n const div = document.createElement('div');\r\n div.innerHTML = html.trim();\r\n return div.firstElementChild;\r\n}\r\n\r\n/**\r\n * Removes an attribute from a HTMLElement and returns the value.\r\n * @param el\r\n * @param name\r\n * @return {string}\r\n */\r\nexport function removeAttribute(el, name) {\r\n const value = el.getAttribute(name);\r\n el.removeAttribute(name);\r\n return value;\r\n}\r\n\r\n/**\r\n * Creates a new html element, every element which has\r\n * a 'data-key' attribute will be saved in a object (which will be returned)\r\n * where the value of 'data-key' ist the object-key and the value the HTMLElement.\r\n *\r\n * It's possible to create a hierarchy if you add a 'data-con' attribute. Every\r\n * sibling will be added to the object which will get the name from the 'data-con' attribute.\r\n *\r\n * If you want to create an Array out of multiple elements, you can use the 'data-arr' attribute,\r\n * the value defines the key and all elements, which has the same parent and the same 'data-arr' attribute,\r\n * would be added to it.\r\n *\r\n * @param str - The HTML String.\r\n */\r\nexport function createFromTemplate(str) {\r\n\r\n // Recursive function to resolve template\r\n function resolve(element, base = {}) {\r\n\r\n // Check key and container attribute\r\n const con = removeAttribute(element, 'data-con');\r\n const key = removeAttribute(element, 'data-key');\r\n\r\n // Check and save element\r\n if (key) {\r\n base[key] = element;\r\n }\r\n\r\n // Check all children\r\n const subtree = con ? (base[con] = {}) : base;\r\n for (let child of Array.from(element.children)) {\r\n\r\n // Check if element should be saved as array\r\n const arr = removeAttribute(child, 'data-arr');\r\n if (arr) {\r\n\r\n // Check if there is already an array and add element\r\n (subtree[arr] || (subtree[arr] = [])).push(child);\r\n } else {\r\n resolve(child, subtree);\r\n }\r\n }\r\n\r\n return base;\r\n }\r\n\r\n return resolve(createElementFromString(str));\r\n}\r\n\r\n/**\r\n * Polyfill for safari & firefox for the eventPath event property.\r\n * @param evt The event object.\r\n * @return [String] event path.\r\n */\r\nexport function eventPath(evt) {\r\n let path = evt.path || (evt.composedPath && evt.composedPath());\r\n if (path) return path;\r\n\r\n let el = evt.target.parentElement;\r\n path = [evt.target, el];\r\n while (el = el.parentElement) path.push(el);\r\n\r\n path.push(document, window);\r\n return path;\r\n}\r\n\r\n/**\r\n * Creates the ability to change numbers in an input field with the scroll-wheel.\r\n * @param el\r\n * @param mapper\r\n */\r\nexport function adjustableInputNumbers(el, mapper = v => v) {\r\n\r\n function handleScroll(e) {\r\n const inc = ([0.001, 0.01, 0.1])[Number(e.shiftKey || e.ctrlKey * 2)] * (e.deltaY < 0 ? 1 : -1);\r\n\r\n let index = 0;\r\n let off = el.selectionStart;\r\n el.value = el.value.replace(/[\\d.]+/g, (v, i) => {\r\n\r\n // Check if number is in cursor range and increase it\r\n if (i <= off && i + v.length >= off) {\r\n off = i;\r\n return mapper(Number(v), inc, index);\r\n }\r\n\r\n index++;\r\n return v;\r\n });\r\n\r\n el.focus();\r\n el.setSelectionRange(off, off);\r\n\r\n // Prevent default and trigger input event\r\n e.preventDefault();\r\n el.dispatchEvent(new Event('input'));\r\n }\r\n\r\n // Bind events\r\n on(el, 'focus', () => on(window, 'wheel', handleScroll, {passive: false}));\r\n on(el, 'blur', () => off(window, 'wheel', handleScroll));\r\n}\r\n","// Shorthands\r\nconst {min, max, floor, round} = Math;\r\n\r\n/**\r\n * Tries to convert a color name to rgb/a hex representation\r\n * @param name\r\n * @returns {string | CanvasGradient | CanvasPattern}\r\n */\r\nfunction standardizeColor(name) {\r\n const ctx = document.createElement('canvas').getContext('2d');\r\n ctx.fillStyle = name;\r\n return ctx.fillStyle;\r\n}\r\n\r\n/**\r\n * Convert HSV spectrum to RGB.\r\n * @param h Hue\r\n * @param s Saturation\r\n * @param v Value\r\n * @returns {number[]} Array with rgb values.\r\n */\r\nexport function hsvToRgb(h, s, v) {\r\n h = (h / 360) * 6;\r\n s /= 100;\r\n v /= 100;\r\n\r\n let i = floor(h);\r\n\r\n let f = h - i;\r\n let p = v * (1 - s);\r\n let q = v * (1 - f * s);\r\n let t = v * (1 - (1 - f) * s);\r\n\r\n let mod = i % 6;\r\n let r = [v, q, p, p, t, v][mod];\r\n let g = [t, v, v, q, p, p][mod];\r\n let b = [p, p, t, v, v, q][mod];\r\n\r\n return [\r\n r * 255,\r\n g * 255,\r\n b * 255\r\n ];\r\n}\r\n\r\n/**\r\n * Convert HSV spectrum to Hex.\r\n * @param h Hue\r\n * @param s Saturation\r\n * @param v Value\r\n * @returns {string[]} Hex values\r\n */\r\nexport function hsvToHex(h, s, v) {\r\n return hsvToRgb(h, s, v).map(v =>\r\n round(v).toString(16).padStart(2, '0')\r\n );\r\n}\r\n\r\n/**\r\n * Convert HSV spectrum to CMYK.\r\n * @param h Hue\r\n * @param s Saturation\r\n * @param v Value\r\n * @returns {number[]} CMYK values\r\n */\r\nexport function hsvToCmyk(h, s, v) {\r\n const rgb = hsvToRgb(h, s, v);\r\n const r = rgb[0] / 255;\r\n const g = rgb[1] / 255;\r\n const b = rgb[2] / 255;\r\n\r\n let k, c, m, y;\r\n\r\n k = min(1 - r, 1 - g, 1 - b);\r\n\r\n c = k === 1 ? 0 : (1 - r - k) / (1 - k);\r\n m = k === 1 ? 0 : (1 - g - k) / (1 - k);\r\n y = k === 1 ? 0 : (1 - b - k) / (1 - k);\r\n\r\n return [\r\n c * 100,\r\n m * 100,\r\n y * 100,\r\n k * 100\r\n ];\r\n}\r\n\r\n/**\r\n * Convert HSV spectrum to HSL.\r\n * @param h Hue\r\n * @param s Saturation\r\n * @param v Value\r\n * @returns {number[]} HSL values\r\n */\r\nexport function hsvToHsl(h, s, v) {\r\n s /= 100, v /= 100;\r\n\r\n let l = (2 - s) * v / 2;\r\n\r\n if (l !== 0) {\r\n if (l === 1) {\r\n s = 0;\r\n } else if (l < 0.5) {\r\n s = s * v / (l * 2);\r\n } else {\r\n s = s * v / (2 - l * 2);\r\n }\r\n }\r\n\r\n return [\r\n h,\r\n s * 100,\r\n l * 100\r\n ];\r\n}\r\n\r\n/**\r\n * Convert RGB to HSV.\r\n * @param r Red\r\n * @param g Green\r\n * @param b Blue\r\n * @return {number[]} HSV values.\r\n */\r\nfunction rgbToHsv(r, g, b) {\r\n r /= 255, g /= 255, b /= 255;\r\n\r\n let h, s, v;\r\n const minVal = min(r, g, b);\r\n const maxVal = max(r, g, b);\r\n const delta = maxVal - minVal;\r\n\r\n v = maxVal;\r\n if (delta === 0) {\r\n h = s = 0;\r\n } else {\r\n s = delta / maxVal;\r\n let dr = (((maxVal - r) / 6) + (delta / 2)) / delta;\r\n let dg = (((maxVal - g) / 6) + (delta / 2)) / delta;\r\n let db = (((maxVal - b) / 6) + (delta / 2)) / delta;\r\n\r\n if (r === maxVal) {\r\n h = db - dg;\r\n } else if (g === maxVal) {\r\n h = (1 / 3) + dr - db;\r\n } else if (b === maxVal) {\r\n h = (2 / 3) + dg - dr;\r\n }\r\n\r\n if (h < 0) {\r\n h += 1;\r\n } else if (h > 1) {\r\n h -= 1;\r\n }\r\n }\r\n\r\n return [\r\n h * 360,\r\n s * 100,\r\n v * 100\r\n ];\r\n}\r\n\r\n/**\r\n * Convert CMYK to HSV.\r\n * @param c Cyan\r\n * @param m Magenta\r\n * @param y Yellow\r\n * @param k Key (Black)\r\n * @return {number[]} HSV values.\r\n */\r\nfunction cmykToHsv(c, m, y, k) {\r\n c /= 100, m /= 100, y /= 100, k /= 100;\r\n\r\n const r = (1 - min(1, c * (1 - k) + k)) * 255;\r\n const g = (1 - min(1, m * (1 - k) + k)) * 255;\r\n const b = (1 - min(1, y * (1 - k) + k)) * 255;\r\n\r\n return [...rgbToHsv(r, g, b)];\r\n}\r\n\r\n/**\r\n * Convert HSL to HSV.\r\n * @param h Hue\r\n * @param s Saturation\r\n * @param l Lightness\r\n * @return {number[]} HSV values.\r\n */\r\nfunction hslToHsv(h, s, l) {\r\n s /= 100, l /= 100;\r\n s *= l < 0.5 ? l : 1 - l;\r\n\r\n let ns = (2 * s / (l + s)) * 100;\r\n let v = (l + s) * 100;\r\n return [h, ns, v];\r\n}\r\n\r\n/**\r\n * Convert HEX to HSV.\r\n * @param hex Hexadecimal string of rgb colors, can have length 3 or 6.\r\n * @return {number[]} HSV values.\r\n */\r\nfunction hexToHsv(hex) {\r\n return rgbToHsv(...hex.match(/.{2}/g).map(v => parseInt(v, 16)));\r\n}\r\n\r\n/**\r\n * Try's to parse a string which represents a color to a HSV array.\r\n * Current supported types are cmyk, rgba, hsla and hexadecimal.\r\n * @param str\r\n * @return {*}\r\n */\r\nexport function parseToHSV(str) {\r\n\r\n // Check if string is a color-name\r\n str = str.match(/^[a-zA-Z]+$/) ? standardizeColor(str) : str;\r\n\r\n // Regular expressions to match different types of color represention\r\n const regex = {\r\n cmyk: /^cmyk[\\D]+(\\d+)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]+(\\d+)/i,\r\n rgba: /^(rgb|rgba)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]*?([\\d.]+|$)/i,\r\n hsla: /^(hsl|hsla)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]*?([\\d.]+|$)/i,\r\n hsva: /^(hsv|hsva)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]*?([\\d.]+|$)/i,\r\n hex: /^#?(([\\dA-Fa-f]{3,4})|([\\dA-Fa-f]{6})|([\\dA-Fa-f]{8}))$/i\r\n };\r\n\r\n /**\r\n * Takes an Array of any type, convert strings which represents\r\n * a number to a number an anything else to undefined.\r\n * @param array\r\n * @return {*}\r\n */\r\n const numarize = array => array.map(v => /^(|\\d+)\\.\\d+|\\d+$/.test(v) ? Number(v) : undefined);\r\n\r\n let match;\r\n for (const type in regex) {\r\n\r\n // Check if current scheme passed\r\n if (!(match = regex[type].exec(str)))\r\n continue;\r\n\r\n // Try to convert\r\n switch (type) {\r\n case 'cmyk': {\r\n let [, c, m, y, k] = numarize(match);\r\n\r\n if (c > 100 || m > 100 || y > 100 || k > 100)\r\n break;\r\n\r\n return {values: [...cmykToHsv(c, m, y, k), 1], type};\r\n }\r\n case 'rgba': {\r\n let [, , r, g, b, a = 1] = numarize(match);\r\n\r\n if (r > 255 || g > 255 || b > 255 || a < 0 || a > 1)\r\n break;\r\n\r\n return {values: [...rgbToHsv(r, g, b), a], type};\r\n }\r\n case 'hex': {\r\n const splitAt = (s, i) => [s.substring(0, i), s.substring(i, s.length)];\r\n let [, hex] = match;\r\n\r\n // Fill up opacity if not declared\r\n if (hex.length === 3) {\r\n hex += 'F';\r\n } else if (hex.length === 6) {\r\n hex += 'FF';\r\n }\r\n\r\n let alpha;\r\n if (hex.length === 4) {\r\n [hex, alpha] = splitAt(hex, 3).map(v => v + v);\r\n } else if (hex.length === 8) {\r\n [hex, alpha] = splitAt(hex, 6);\r\n }\r\n\r\n // Convert 0 - 255 to 0 - 1 for opacity\r\n alpha = parseInt(alpha, 16) / 255;\r\n return {values: [...hexToHsv(hex), alpha], type};\r\n }\r\n case 'hsla': {\r\n let [, , h, s, l, a = 1] = numarize(match);\r\n\r\n if (h > 360 || s > 100 || l > 100 || a < 0 || a > 1)\r\n break;\r\n\r\n return {values: [...hslToHsv(h, s, l), a], type};\r\n }\r\n case 'hsva': {\r\n let [, , h, s, v, a = 1] = numarize(match);\r\n\r\n if (h > 360 || s > 100 || v > 100 || a < 0 || a > 1)\r\n break;\r\n\r\n return {values: [h, s, v, a], type};\r\n }\r\n }\r\n }\r\n\r\n return {values: null, type: null};\r\n}\r\n","import {hsvToHsl, hsvToRgb, hsvToCmyk, hsvToHex} from './color';\r\n\r\n/**\r\n * Simple class which holds the properties\r\n * of the color represention model hsla (hue saturation lightness alpha)\r\n */\r\nexport function HSVaColor(h = 0, s = 0, v = 0, a = 1) {\r\n const {ceil} = Math;\r\n\r\n const that = {\r\n h, s, v, a,\r\n\r\n toHSVA() {\r\n const hsva = [that.h, that.s, that.v];\r\n const rhsva = hsva.map(ceil);\r\n\r\n hsva.push(that.a);\r\n hsva.toString = () => `hsva(${rhsva[0]}, ${rhsva[1]}%, ${rhsva[2]}%, ${that.a.toFixed(1)})`;\r\n return hsva;\r\n },\r\n\r\n toHSLA() {\r\n const hsla = hsvToHsl(that.h, that.s, that.v);\r\n const rhsla = hsla.map(ceil);\r\n\r\n hsla.push(that.a);\r\n hsla.toString = () => `hsla(${rhsla[0]}, ${rhsla[1]}%, ${rhsla[2]}%, ${that.a.toFixed(1)})`;\r\n return hsla;\r\n },\r\n\r\n toRGBA() {\r\n const rgba = hsvToRgb(that.h, that.s, that.v);\r\n const rrgba = rgba.map(ceil);\r\n\r\n rgba.push(that.a);\r\n rgba.toString = () => `rgba(${rrgba[0]}, ${rrgba[1]}, ${rrgba[2]}, ${that.a.toFixed(1)})`;\r\n return rgba;\r\n },\r\n\r\n toCMYK() {\r\n const cmyk = hsvToCmyk(that.h, that.s, that.v);\r\n const rcmyk = cmyk.map(ceil);\r\n\r\n cmyk.toString = () => `cmyk(${rcmyk[0]}%, ${rcmyk[1]}%, ${rcmyk[2]}%, ${rcmyk[3]}%)`;\r\n return cmyk;\r\n },\r\n\r\n toHEXA() {\r\n const hex = hsvToHex(that.h, that.s, that.v);\r\n\r\n hex.toString = () => {\r\n\r\n // Check if alpha channel make sense, convert it to 255 number space, convert\r\n // to hex and pad it with zeros if needet.\r\n const alpha = that.a >= 1 ? '' : Number((that.a * 255).toFixed(0))\r\n .toString(16)\r\n .toUpperCase().padStart(2, '0');\r\n\r\n return `#${hex.join('').toUpperCase() + alpha}`;\r\n };\r\n\r\n return hex;\r\n },\r\n\r\n clone() {\r\n return HSVaColor(that.h, that.s, that.v, that.a);\r\n }\r\n };\r\n\r\n return that;\r\n}\r\n","import * as _ from '../utils/utils';\r\n\r\nconst clamp = v => Math.max(Math.min(v, 1), 0);\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 lock: null,\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: {lock}, cache} = that;\r\n const {element, wrapper} = options;\r\n const b = 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 (lock !== 'h') {\r\n element.style.left = `calc(${x / b.width * 100}% - ${element.offsetWidth / 2}px)`;\r\n }\r\n\r\n if (lock !== 'v') {\r\n element.style.top = `calc(${y / b.height * 100}% - ${element.offsetHeight / 2}px)`;\r\n }\r\n\r\n that.cache = {x: x / b.width, y: y / b.height};\r\n const cx = clamp(x / wrapper.offsetWidth);\r\n const cy = clamp(y / wrapper.offsetHeight);\r\n\r\n switch (lock) {\r\n case 'v':\r\n return options.onchange(cx);\r\n case 'h':\r\n return options.onchange(cy);\r\n default:\r\n return options.onchange(cx, cy);\r\n }\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 {left, top, width, height} = that.options.wrapper.getBoundingClientRect();\r\n that._tapmove({\r\n clientX: left + width * x,\r\n clientY: top + height * 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 '../utils/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 * as _ from './utils/utils';\r\n\r\nexport default ({components: c, strings: s, useAsButton, inline, appClass}) => {\r\n const hidden = con => con ? '' : 'style=\"display:none\" hidden';\r\n\r\n const root = _.createFromTemplate(`\r\n
\r\n\r\n ${useAsButton ? '' : ''}\r\n\r\n
\r\n
\r\n
\r\n \r\n
\r\n
\r\n\r\n
\r\n
\r\n
\r\n
\r\n\r\n
\r\n
\r\n
\r\n
\r\n\r\n
\r\n
\r\n
\r\n
\r\n
\r\n\r\n
\r\n\r\n
\r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n
\r\n
\r\n
\r\n `);\r\n\r\n const int = root.interaction;\r\n\r\n // Select option which is not hidden\r\n int.options.find(o => !o.hidden && !o.classList.add('active'));\r\n\r\n // Create method to find currenlty active option\r\n int.type = () => int.options.find(e => e.classList.contains('active'));\r\n return root;\r\n}\r\n","// Import utils\nimport * as _ from './utils/utils';\nimport * as Color from './utils/color';\n\n// Import classes\nimport {HSVaColor} from './utils/hsvacolor';\nimport Moveable from './libs/moveable';\nimport Selectable from './libs/selectable';\nimport Nanopop from './libs/nanopop';\nimport buildPickr from './template';\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 appClass: null,\n useAsButton: false,\n disabled: false,\n comparison: true,\n\n components: {\n interaction: {}\n },\n\n strings: {},\n swatches: null,\n inline: false,\n sliders: 'v',\n\n default: '#42445A',\n defaultRepresentation: null,\n position: 'bottom-middle',\n adjustableNumbers: true,\n showAlways: false,\n\n closeWithKey: 'Escape'\n }, opt);\n\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 // Initialize positioning engine\n this._nanopop = Nanopop({\n reference: this._root.button,\n el: this._root.app\n });\n\n // Initilization is finish, pickr is visible and ready for usage\n const {button} = this._root;\n const that = this;\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);\n }\n\n // Apply default color\n that.setColor(opt.default);\n that._rePositioningPicker();\n\n // Initialize color representation\n if (opt.defaultRepresentation) {\n that._representation = opt.defaultRepresentation;\n that.setColorRepresentation(that._representation);\n }\n\n // Show pickr if locked\n if (opt.showAlways) {\n that.show();\n }\n\n // Initialization is done - pickr is usable, fire init event\n that._initializingActive = false;\n that._emit('init');\n }));\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 = buildPickr(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 const [so, sh] = (() => {\n const {sliders} = inst.options;\n let so = 'v', sh = 'v';\n\n if (sliders.match(/^[vh]+$/g)) {\n if (sliders.length > 1) {\n [so, sh] = sliders;\n } else {\n so = sh = sliders;\n }\n }\n\n const opposite = {v: 'h', h: 'v'};\n return [opposite[so], opposite[sh]];\n })();\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 * 100;\n\n // Calculate the value\n _color.v = 100 - y * 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 (!inst.options.comparison) {\n\n // If the user changes the color, remove the cleared icon\n _root.button.classList.remove('clear');\n }\n }\n }),\n\n hue: Moveable({\n lock: sh,\n element: inst._root.hue.picker,\n wrapper: inst._root.hue.slider,\n\n onchange(v) {\n if (!comp.hue || !comp.palette) return;\n\n // Calculate hue\n inst._color.h = v * 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 lock: so,\n element: inst._root.opacity.picker,\n wrapper: inst._root.opacity.slider,\n\n onchange(v) {\n if (!comp.opacity || !comp.palette) return;\n\n // Calculate opacity\n inst._color.a = Math.round(v * 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 const ranges = {\n rgba: [255, 255, 255, 1],\n hsva: [360, 100, 100, 1],\n hsla: [360, 100, 100, 1],\n cmyk: [100, 100, 100, 100]\n };\n\n _.adjustableInputNumbers(_root.interaction.result, (o, step, index) => {\n const range = ranges[this.getColorRepresentation().toLowerCase()];\n\n if (range) {\n const max = range[index];\n\n // Calculate next reasonable number\n const nv = o + (max >= 100 ? step * 1000 : step);\n\n // Apply range of zero up to max, fix floating-point issues\n return nv <= 0 ? 0 : Number((nv < max ? nv : max).toPrecision(3));\n } else {\n return o;\n }\n });\n }\n\n if (!options.inline) {\n let timeout = null;\n const that = this;\n\n // Re-calc position on window resize, scroll and wheel\n eventBindings.push(\n _.on(window, ['scroll', 'resize'], () => {\n if (that.isOpen()) {\n if (timeout === null) {\n timeout = setTimeout(() => timeout = null, 100);\n\n // Update position on every frame\n requestAnimationFrame(function rs() {\n that._rePositioningPicker();\n (timeout !== null) && requestAnimationFrame(rs);\n });\n } else {\n clearTimeout(timeout);\n timeout = setTimeout(() => timeout = null, 100);\n }\n }\n })\n );\n }\n\n // Save bindings\n this._eventBindings = eventBindings;\n }\n\n _rePositioningPicker() {\n const {options} = this;\n\n // No repositioning needed if inline\n if (!options.inline) {\n this._nanopop.update(options.position);\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 // Override current color and re-active color calculation\n this._color = HSVaColor(h, s, v, a);\n\n // Update slider and palette\n const {hue, opacity, palette} = this.components;\n hue.update(0, (h / 360));\n opacity.update(0, a);\n palette.update(s / 100, 1 - (v / 100));\n\n // Restore old state\n this._recalc = recalc;\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\n// Expose pickr utils\nPickr.utils = _;\n\n// Create instance via method\nPickr.create = options => new Pickr(options);\n\n// Assign version and export\nPickr.version = '0.6.4';\nexport default Pickr;\n","/**\n * Micro positioning-engine\n * @param el\n * @param reference\n * @param pos\n * @param padding\n * @returns {{update(): void}}\n * @constructor\n */\nexport default function Nanopop({el, reference, padding = 8}) {\n const vBehaviour = {start: 'sme', middle: 'mse', end: 'ems'};\n const hBehaviour = {top: 'tb', right: 'rl', bottom: 'bt', left: 'lr'};\n\n const getInfo = ((cache = {}) => (pos, cached = cache[pos]) => {\n if (cached) return cached;\n const [position, variant = 'middle'] = pos.split('-');\n const isVertical = (position === 'top' || position === 'bottom');\n\n return cache[pos] = {\n position,\n variant,\n isVertical\n };\n })();\n\n return {\n update(pos) {\n const {position, variant, isVertical} = getInfo(pos);\n const rb = reference.getBoundingClientRect();\n const eb = el.getBoundingClientRect();\n\n const positions = isVertical ? {\n t: rb.top - eb.height - padding,\n b: rb.bottom + padding\n } : {\n r: rb.right + padding,\n l: rb.left - eb.width - padding\n };\n\n const variants = isVertical ? {\n s: rb.left + rb.width - eb.width,\n m: (-eb.width / 2) + (rb.left + rb.width / 2),\n e: rb.left\n } : {\n s: rb.bottom - eb.height,\n m: rb.bottom - rb.height / 2 - eb.height / 2,\n e: rb.bottom - rb.height\n };\n\n\n function apply(bevs, vars, styleprop) {\n const vertical = styleprop === 'top';\n const adder = vertical ? eb.height : eb.width;\n const win = window[vertical ? 'innerHeight' : 'innerWidth'];\n\n for (const ch of bevs) {\n const v = vars[ch];\n if (v > 0 && (v + adder) < win) {\n el.style[styleprop] = `${v}px`;\n return true;\n }\n }\n\n return false;\n }\n\n const v1Ok = apply(vBehaviour[variant], variants, isVertical ? 'left' : 'top');\n const v2Ok = apply(hBehaviour[position], positions, isVertical ? 'top' : 'left');\n if (!v1Ok || !v2Ok) {\n Object.assign(el.style, {\n top: `${padding}px`,\n left: 0,\n right: 0,\n margin: 'auto'\n });\n } else {\n el.style.margin = 'inherit';\n }\n }\n };\n}\n"],"sourceRoot":""} \ No newline at end of file diff --git a/src/js/libs/nanopop.js b/src/js/libs/nanopop.js index d18f19ec..722c9164 100644 --- a/src/js/libs/nanopop.js +++ b/src/js/libs/nanopop.js @@ -7,14 +7,25 @@ * @returns {{update(): void}} * @constructor */ -export default function Nanopop({el, reference, pos, padding = 8}) { +export default function Nanopop({el, reference, padding = 8}) { const vBehaviour = {start: 'sme', middle: 'mse', end: 'ems'}; const hBehaviour = {top: 'tb', right: 'rl', bottom: 'bt', left: 'lr'}; - const [position, variant = 'middle'] = pos.split('-'); - const isVertical = (position === 'top' || position === 'bottom'); + + const getInfo = ((cache = {}) => (pos, cached = cache[pos]) => { + if (cached) return cached; + const [position, variant = 'middle'] = pos.split('-'); + const isVertical = (position === 'top' || position === 'bottom'); + + return cache[pos] = { + position, + variant, + isVertical + }; + })(); return { - update() { + update(pos) { + const {position, variant, isVertical} = getInfo(pos); const rb = reference.getBoundingClientRect(); const eb = el.getBoundingClientRect(); @@ -36,6 +47,7 @@ export default function Nanopop({el, reference, pos, padding = 8}) { e: rb.bottom - rb.height }; + function apply(bevs, vars, styleprop) { const vertical = styleprop === 'top'; const adder = vertical ? eb.height : eb.width; @@ -45,13 +57,25 @@ export default function Nanopop({el, reference, pos, padding = 8}) { const v = vars[ch]; if (v > 0 && (v + adder) < win) { el.style[styleprop] = `${v}px`; - break; + return true; } } + + return false; } - apply(vBehaviour[variant], variants, isVertical ? 'left' : 'top'); - apply(hBehaviour[position], positions, isVertical ? 'top' : 'left'); + const v1Ok = apply(vBehaviour[variant], variants, isVertical ? 'left' : 'top'); + const v2Ok = apply(hBehaviour[position], positions, isVertical ? 'top' : 'left'); + if (!v1Ok || !v2Ok) { + Object.assign(el.style, { + top: `${padding}px`, + left: 0, + right: 0, + margin: 'auto' + }); + } else { + el.style.margin = 'inherit'; + } } }; } diff --git a/src/js/pickr.js b/src/js/pickr.js index 322579c9..c43e7459 100644 --- a/src/js/pickr.js +++ b/src/js/pickr.js @@ -1,4 +1,3 @@ - // Import utils import * as _ from './utils/utils'; import * as Color from './utils/color'; @@ -58,7 +57,7 @@ class Pickr { closeWithKey: 'Escape' }, opt); - const {swatches, inline, components, position} = opt; + const {swatches, inline, components} = opt; // Check interaction section if (!components.interaction) { @@ -90,8 +89,7 @@ class Pickr { // Initialize positioning engine this._nanopop = Nanopop({ reference: this._root.button, - el: this._root.app, - pos: position + el: this._root.app }); // Initilization is finish, pickr is visible and ready for usage @@ -428,10 +426,11 @@ class Pickr { } _rePositioningPicker() { + const {options} = this; // No repositioning needed if inline - if (!this.options.inline) { - this._nanopop.update(); + if (!options.inline) { + this._nanopop.update(options.position); } }