diff --git a/README.md b/README.md index d080eaa5..a19dc1f3 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ alt="JSDelivr download count" src="https://data.jsdelivr.com/v1/package/npm/@simonwep/pickr/badge"> Current version + src="https://img.shields.io/badge/version-1.1.0-f1c40f.svg?style=popout-square"> Support me diff --git a/dist/pickr.es5.min.js b/dist/pickr.es5.min.js index e150c495..1f3092b3 100644 --- a/dist/pickr.es5.min.js +++ b/dist/pickr.es5.min.js @@ -1,3 +1,3 @@ -/*! Pickr 1.0.1 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,l=void 0;try{for(var s,u=e[Symbol.iterator]();!(a=(s=u.next()).done);a=!0){var p=s.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,l=t}finally{try{a||null==u.return||u.return()}finally{if(c)throw l}}return Array.prototype.slice.call(arguments,1)}function s(t){var e=document.createElement("div");return e.innerHTML=t.trim(),e.firstElementChild}function u(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=u(e,"data-con"),o=u(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(Number)};t:for(var a in o)if(r=o[a].exec(t))switch(a){case"cmyk":var c=f(i(r),5),l=c[1],s=c[2],u=c[3],p=c[4];if(l>100||s>100||u>100||p>100)break t;return{values:[].concat(v(k(l,s,u,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 t;return{values:[].concat(v(w(d,y,m)),[b]),type:a};case"hex":var _=f(r,2)[1];4!==_.length&&3!==_.length||(_=_.split("").map(function(t){return t+t}).join("")),6===_.length&&(_+="ff");var S=[_.substring(0,6),_.substring(6)],O=S[0],j=S[1];return j=parseInt(j,16)/255,{values:[].concat(v(C(O)),[j]),type:a};case"hsla":var E=f(i(r),6),x=E[2],P=E[3],B=E[4],L=E[5],R=void 0===L?1:L;if(x>360||P>100||B>100||R<0||R>1)break t;return{values:[].concat(v(A(x,P,B)),[R]),type:a};case"hsva":var H=f(i(r),6),D=H[2],T=H[3],M=H[4],N=H[5],F=void 0===N?1:N;if(D>360||T>100||M>100||F<0||F>1)break t;return{values:[D,T,M,F],type:a}}return{values:null,type:null}}function O(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e0&&void 0!==arguments[0]?arguments[0]:0,s:arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,v:arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,a:arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,toHSVA:function(){var e=[t.h,t.s,t.v,t.a];return e.toString=function(){return"hsva(".concat(t.h,", ").concat(t.s,"%, ").concat(t.v,"%, ").concat(t.a,")")},e},toHSLA:function(){var e=[].concat(O(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]}(t.h,t.s,t.v)),[t.a]);return e.toString=function(){return"hsla(".concat(e[0],", ").concat(e[1],"%, ").concat(e[2],"%, ").concat(e[3].toFixed(1),")")},e},toRGBA:function(){var e=[].concat(O(_(t.h,t.s,t.v)),[t.a]);return e.toString=function(){return"rgba(".concat(e[0],", ").concat(e[1],", ").concat(e[2],", ").concat(e[3].toFixed(1),")")},e},toCMYK:function(){var e=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]}(t.h,t.s,t.v);return e.toString=function(){return"cmyk(".concat(e[0],"%, ").concat(e[1],"%, ").concat(e[2],"%, ").concat(e[3],"%)")},e},toHEXA:function(){var e=function(t,e,n){return _(t,e,n).map(function(t){return b(t).toString(16).padStart(2,"0")})}(t.h,t.s,t.v),n=t.a>=1?"":Number((255*t.a).toFixed(0)).toString(16).toUpperCase().padStart(2,"0");return n&&e.push(n),e.toString=function(){return"#".concat(e.join("").toUpperCase())},e},clone:function(){return j(t.h,t.s,t.v,t.a)}};return t}var E=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(),l=0,s=0;if(t){var u=t&&t.touches&&t.touches[0];l=t?(u||t).clientX:0,s=t?(u||t).clientY:0,lc.left+c.width&&(l=c.left+c.width),sc.top+c.height&&(s=c.top+c.height),l-=c.left,s-=c.top}else o&&(l=o.x*c.width,s=o.y*c.height);"h"!==r&&(i.style.left="calc(".concat(l/c.width*100,"% - ").concat(i.offsetWidth/2,"px)")),"v"!==r&&(i.style.top="calc(".concat(s/c.height*100,"% - ").concat(i.offsetHeight/2,"px)")),e.cache={x:l/c.width,y:s/c.height};var p=E(l/a.offsetWidth),h=E(s/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;"h"===e.options.lock&&(n=t),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 P(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e0&&void 0!==arguments[0]?arguments[0]:{};t=Object.assign({onchange:function(){return 0},className:"",elements:[]},t);var e=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,P(e))}}}function L(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 R(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=L(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=y(t),n=e.position,r=e.variant,o=e.isVertical,i=p.getBoundingClientRect(),a=u.getBoundingClientRect(),c=function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;t=t.parentElement;)e+=t.scrollTop;return e}(u),l=function(t){return t?{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 s(t,e,n){var r="top"===n,o=r?a.height:a.width,i=window[r?"innerHeight":"innerWidth"],c=!0,l=!1,s=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 \n ")),(s=l.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")})},l),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&&e.match(/^[vh]+$/g))if(e.length>1){var o=H(e,2);n=o[0],r=o[1]}else n=r=e;var i={v:"h",h:"v"};return[i[n],i[r]]}(),r=H(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;t._recalc&&(o.s=100*n,o.v=100-100*r,o.v<0&&(o.v=0),t._updateOutput());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.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._recalc&&(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._recalc&&(t._color.a=Math.round(100*n)/100),this.element.style.background="rgba(0, 0, 0, ".concat(t._color.a,")"),a.palette.trigger())}}),selectable:B({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.interaction.cancel,e.preview.lastColor],"click",function(){return t.setHSVA.apply(t,R(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((c0&&void 0!==arguments[0]&&arguments[0],e=this._root,n=this.options;n.useAsButton||(e.button.style.color="rgba(0, 0, 0, 0.15)"),e.button.classList.add("clear"),n.showAlways||this.hide(),this._initializingActive||t||this._emit("save",null)}},{key:"_emit",value:function(t){for(var e=this,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o'));return o.swatches.appendChild(c),r.push({element:c,hsvaColorObject:i}),this._eventBindings.push(a(c,"click",function(){e.setHSVA.apply(e,R(i.toHSVA()).concat([!0])),e._emit("swatchselect",i)})),!0}return!1}},{key:"removeSwatch",value:function(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,R(t))}),Object.keys(this._components).forEach(function(e){return t._components[e].destroy()})}},{key:"destroyAndRemove",value:function(){var t=this;this.destroy();var e=this._root,n=e.root,r=e.app;n.parentElement.removeChild(n),r.parentElement.removeChild(r),Object.keys(this).forEach(function(e){return t[e]=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=j(t,e,n,r);var a=this._components,c=a.hue,l=a.opacity,s=a.palette;return c.update(t/360),l.update(r),s.update(e/100,1-n/100),o||this.applyColor(),i&&this._updateOutput(),this._recalc=i,!0}},{key:"setColor",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(null===t)return this._clearColor(e),!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 l=!0,s=!1,u=void 0;try{for(var p,h=a[Symbol.iterator]();!(l=(p=h.next()).done);l=!0){var d=p.value;d.classList[d===c?"add":"remove"]("active")}}catch(t){s=!0,u=t}finally{try{l||null==h.return||h.return()}finally{if(s)throw u}}}return this.setHSVA.apply(this,R(r).concat([e]))}return!1}},{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}}])&&D(e.prototype,n),o&&D(e,o),t}();M.utils=r,M.create=function(t){return new M(t)},M.version="1.0.1";e.default=M}]).default}); +/*! Pickr 1.1.0 MIT | https://github.com/Simonwep/pickr */ +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Pickr=e():t.Pickr=e()}(window,function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=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,l=void 0;try{for(var s,u=e[Symbol.iterator]();!(a=(s=u.next()).done);a=!0){var p=s.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,l=t}finally{try{a||null==u.return||u.return()}finally{if(c)throw l}}return Array.prototype.slice.call(arguments,1)}function s(t){var e=document.createElement("div");return e.innerHTML=t.trim(),e.firstElementChild}function u(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=u(e,"data-con"),o=u(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(Number)};t:for(var a in o)if(r=o[a].exec(t))switch(a){case"cmyk":var c=f(i(r),5),l=c[1],s=c[2],u=c[3],p=c[4];if(l>100||s>100||u>100||p>100)break t;return{values:[].concat(v(k(l,s,u,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 t;return{values:[].concat(v(w(d,y,m)),[b]),type:a};case"hex":var _=f(r,2)[1];4!==_.length&&3!==_.length||(_=_.split("").map(function(t){return t+t}).join("")),6===_.length&&(_+="ff");var S=[_.substring(0,6),_.substring(6)],O=S[0],j=S[1];return j=parseInt(j,16)/255,{values:[].concat(v(C(O)),[j]),type:a};case"hsla":var E=f(i(r),6),x=E[2],P=E[3],B=E[4],L=E[5],R=void 0===L?1:L;if(x>360||P>100||B>100||R<0||R>1)break t;return{values:[].concat(v(A(x,P,B)),[R]),type:a};case"hsva":var H=f(i(r),6),D=H[2],T=H[3],M=H[4],N=H[5],F=void 0===N?1:N;if(D>360||T>100||M>100||F<0||F>1)break t;return{values:[D,T,M,F],type:a}}return{values:null,type:null}}function O(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e0&&void 0!==arguments[0]?arguments[0]:0,s:arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,v:arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,a:arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,toHSVA:function(){var e=[t.h,t.s,t.v,t.a];return e.toString=function(){return"hsva(".concat(t.h,", ").concat(t.s,"%, ").concat(t.v,"%, ").concat(t.a,")")},e},toHSLA:function(){var e=[].concat(O(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]}(t.h,t.s,t.v)),[t.a]);return e.toString=function(){return"hsla(".concat(e[0],", ").concat(e[1],"%, ").concat(e[2],"%, ").concat(e[3].toFixed(1),")")},e},toRGBA:function(){var e=[].concat(O(_(t.h,t.s,t.v)),[t.a]);return e.toString=function(){return"rgba(".concat(e[0],", ").concat(e[1],", ").concat(e[2],", ").concat(e[3].toFixed(1),")")},e},toCMYK:function(){var e=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]}(t.h,t.s,t.v);return e.toString=function(){return"cmyk(".concat(e[0],"%, ").concat(e[1],"%, ").concat(e[2],"%, ").concat(e[3],"%)")},e},toHEXA:function(){var e=function(t,e,n){return _(t,e,n).map(function(t){return b(t).toString(16).padStart(2,"0")})}(t.h,t.s,t.v),n=t.a>=1?"":Number((255*t.a).toFixed(0)).toString(16).toUpperCase().padStart(2,"0");return n&&e.push(n),e.toString=function(){return"#".concat(e.join("").toUpperCase())},e},clone:function(){return j(t.h,t.s,t.v,t.a)}};return t}var E=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(),l=0,s=0;if(t){var u=t&&t.touches&&t.touches[0];l=t?(u||t).clientX:0,s=t?(u||t).clientY:0,lc.left+c.width&&(l=c.left+c.width),sc.top+c.height&&(s=c.top+c.height),l-=c.left,s-=c.top}else o&&(l=o.x*c.width,s=o.y*c.height);"h"!==r&&(i.style.left="calc(".concat(l/c.width*100,"% - ").concat(i.offsetWidth/2,"px)")),"v"!==r&&(i.style.top="calc(".concat(s/c.height*100,"% - ").concat(i.offsetHeight/2,"px)")),e.cache={x:l/c.width,y:s/c.height};var p=E(l/a.offsetWidth),h=E(s/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;"h"===e.options.lock&&(n=t),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 P(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e0&&void 0!==arguments[0]?arguments[0]:{};t=Object.assign({onchange:function(){return 0},className:"",elements:[]},t);var e=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,P(e))}}}function L(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 R(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=L(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=y(t),n=e.position,r=e.variant,o=e.isVertical,i=p.getBoundingClientRect(),a=u.getBoundingClientRect(),c=function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;t=t.parentElement;)e+=t.scrollTop;return e}(u),l=function(t){return t?{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 s(t,e,n){var r="top"===n,o=r?a.height:a.width,i=window[r?"innerHeight":"innerWidth"],c=!0,l=!1,s=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 \n ")),(s=l.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")})},l),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&&e.match(/^[vh]+$/g))if(e.length>1){var o=H(e,2);n=o[0],r=o[1]}else n=r=e;var i={v:"h",h:"v"};return[i[n],i[r]]}(),r=H(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;t._recalc&&(o.s=100*n,o.v=100-100*r,o.v<0&&(o.v=0),t._updateOutput());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.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._recalc&&(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._recalc&&(t._color.a=Math.round(100*n)/100),this.element.style.background="rgba(0, 0, 0, ".concat(t._color.a,")"),a.palette.trigger())}}),selectable:B({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.interaction.cancel,e.preview.lastColor],"click",function(){return t.setHSVA.apply(t,R(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((c0&&void 0!==arguments[0]&&arguments[0],e=this._root,n=this.options;n.useAsButton||(e.button.style.color="rgba(0, 0, 0, 0.15)"),e.button.classList.add("clear"),n.showAlways||this.hide(),this._initializingActive||t||this._emit("save",null)}},{key:"_emit",value:function(t){for(var e=this,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o'));return o.swatches.appendChild(c),r.push({element:c,hsvaColorObject:i}),this._eventBindings.push(a(c,"click",function(){e.setHSVA.apply(e,R(i.toHSVA()).concat([!0])),e._emit("swatchselect",i)})),!0}return!1}},{key:"removeSwatch",value:function(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,R(t))}),Object.keys(this._components).forEach(function(e){return t._components[e].destroy()})}},{key:"destroyAndRemove",value:function(){var t=this;this.destroy();var e=this._root,n=e.root,r=e.app;n.parentElement.removeChild(n),r.parentElement.removeChild(r),Object.keys(this).forEach(function(e){return t[e]=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=j(t,e,n,r);var a=this._components,c=a.hue,l=a.opacity,s=a.palette;return c.update(t/360),l.update(r),s.update(e/100,1-n/100),o||this.applyColor(),i&&this._updateOutput(),this._recalc=i,!0}},{key:"setColor",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(null===t)return this._clearColor(e),!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 l=!0,s=!1,u=void 0;try{for(var p,h=a[Symbol.iterator]();!(l=(p=h.next()).done);l=!0){var d=p.value;d.classList[d===c?"add":"remove"]("active")}}catch(t){s=!0,u=t}finally{try{l||null==h.return||h.return()}finally{if(s)throw u}}}return this.setHSVA.apply(this,R(r).concat([e]))}return!1}},{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}}])&&D(e.prototype,n),o&&D(e,o),t}();M.utils=r,M.create=function(t){return new M(t)},M.version="1.1.0";e.default=M}]).default}); //# sourceMappingURL=pickr.es5.min.js.map \ No newline at end of file diff --git a/dist/pickr.es5.min.js.map b/dist/pickr.es5.min.js.map index b044f622..28ed789f 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","invalid","type","exec","_numarize2","_slicedToArray","values","concat","_numarize4","_numarize4$","a","split","join","_ref","substring","raw","alpha","_numarize6","_numarize6$","_numarize8","_numarize8$","HSVaColor","that","toHSVA","toString","toHSLA","hsvacolor_toConsumableArray","hsvToHsl","toFixed","toRGBA","toCMYK","rgb","hsvToCmyk","toHEXA","padStart","hsvToHex","toUpperCase","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","theme","useAsButton","disabled","comparison","closeOnScroll","components","interaction","strings","swatches","inline","sliders","default","defaultRepresentation","position","adjustableNumbers","showAlways","closeWithKey","_opt","includes","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","_pos$split2$","variant","isVertical","_getInfo","rb","eb","so","total","scrollTop","getScrollOffset","variants","vertical","bevs","vars","styleprop","adder","win","_i2","_arr2","rot","v2Ok","v1Ok","requestAnimationFrame","cb","offsetParent","body","setColor","_rePositioningPicker","_representation","setColorRepresentation","show","_initializingActive","_emit","hidden","int","reduce","pv","cv","ci","querySelector","shadowRoot","keys","input","cancel","clear","find","add","contains","appendChild","removeChild","lastChild","insertBefore","nextSibling","parentNode","replaceChild","disable","transition","lastColor","hide","inst","cs","sh","_sliders","pickr_slicedToArray","opposite","_ref2","picker","_color","_recalc","_updateOutput","cssRGBaString","background","currentColor","remove","slider","backgroundColor","selectable","_components","_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","silent","event","_this3","_len","args","_key","_eventListener","callBacks","indexOf","splice","_this4","_swatchColors","hsvaColorObject","swatchColor","_this$_root","_this5","_this6","_this$_root2","recalc","_this$_components","string","_parseToHSV2","utype","startsWith","click","utils","version"],"mappings":";CAAA,SAAAA,EAAAC,GACA,iBAAAC,SAAA,iBAAAC,OACAA,OAAAD,QAAAD,IACA,mBAAAG,eAAAC,IACAD,O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MjN,OAAS,SAAAiB,GAAO,OAAI,IAAIgM,EAAMhM,IAGpCgM,EAAM2L,QAAU,QACD3L","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\nconst {min, max, floor, round} = Math;\n\n/**\n * Tries to convert a color name to rgb/a hex representation\n * @param name\n * @returns {string | CanvasGradient | CanvasPattern}\n */\nfunction standardizeColor(name) {\n const ctx = document.createElement('canvas').getContext('2d');\n ctx.fillStyle = name;\n return ctx.fillStyle;\n}\n\n/**\n * Convert HSV spectrum to RGB.\n * @param h Hue\n * @param s Saturation\n * @param v Value\n * @returns {number[]} Array with rgb values.\n */\nexport function hsvToRgb(h, s, v) {\n h = (h / 360) * 6;\n s /= 100;\n v /= 100;\n\n let i = floor(h);\n\n let f = h - i;\n let p = v * (1 - s);\n let q = v * (1 - f * s);\n let t = v * (1 - (1 - f) * s);\n\n let mod = i % 6;\n let r = [v, q, p, p, t, v][mod];\n let g = [t, v, v, q, p, p][mod];\n let b = [p, p, t, v, v, q][mod];\n\n return [\n r * 255,\n g * 255,\n b * 255\n ];\n}\n\n/**\n * Convert HSV spectrum to Hex.\n * @param h Hue\n * @param s Saturation\n * @param v Value\n * @returns {string[]} Hex values\n */\nexport function hsvToHex(h, s, v) {\n return hsvToRgb(h, s, v).map(v =>\n round(v).toString(16).padStart(2, '0')\n );\n}\n\n/**\n * Convert HSV spectrum to CMYK.\n * @param h Hue\n * @param s Saturation\n * @param v Value\n * @returns {number[]} CMYK values\n */\nexport function hsvToCmyk(h, s, v) {\n const rgb = hsvToRgb(h, s, v);\n const r = rgb[0] / 255;\n const g = rgb[1] / 255;\n const b = rgb[2] / 255;\n\n let k, c, m, y;\n\n k = min(1 - r, 1 - g, 1 - b);\n\n c = k === 1 ? 0 : (1 - r - k) / (1 - k);\n m = k === 1 ? 0 : (1 - g - k) / (1 - k);\n y = k === 1 ? 0 : (1 - b - k) / (1 - k);\n\n return [\n c * 100,\n m * 100,\n y * 100,\n k * 100\n ];\n}\n\n/**\n * Convert HSV spectrum to HSL.\n * @param h Hue\n * @param s Saturation\n * @param v Value\n * @returns {number[]} HSL values\n */\nexport function hsvToHsl(h, s, v) {\n s /= 100, v /= 100;\n\n let l = (2 - s) * v / 2;\n\n if (l !== 0) {\n if (l === 1) {\n s = 0;\n } else if (l < 0.5) {\n s = s * v / (l * 2);\n } else {\n s = s * v / (2 - l * 2);\n }\n }\n\n return [\n h,\n s * 100,\n l * 100\n ];\n}\n\n/**\n * Convert RGB to HSV.\n * @param r Red\n * @param g Green\n * @param b Blue\n * @return {number[]} HSV values.\n */\nfunction rgbToHsv(r, g, b) {\n r /= 255, g /= 255, b /= 255;\n\n let h, s, v;\n const minVal = min(r, g, b);\n const maxVal = max(r, g, b);\n const delta = maxVal - minVal;\n\n v = maxVal;\n if (delta === 0) {\n h = s = 0;\n } else {\n s = delta / maxVal;\n let dr = (((maxVal - r) / 6) + (delta / 2)) / delta;\n let dg = (((maxVal - g) / 6) + (delta / 2)) / delta;\n let db = (((maxVal - b) / 6) + (delta / 2)) / delta;\n\n if (r === maxVal) {\n h = db - dg;\n } else if (g === maxVal) {\n h = (1 / 3) + dr - db;\n } else if (b === maxVal) {\n h = (2 / 3) + dg - dr;\n }\n\n if (h < 0) {\n h += 1;\n } else if (h > 1) {\n h -= 1;\n }\n }\n\n return [\n h * 360,\n s * 100,\n v * 100\n ];\n}\n\n/**\n * Convert CMYK to HSV.\n * @param c Cyan\n * @param m Magenta\n * @param y Yellow\n * @param k Key (Black)\n * @return {number[]} HSV values.\n */\nfunction cmykToHsv(c, m, y, k) {\n c /= 100;\n m /= 100;\n y /= 100;\n k /= 100;\n\n const r = (1 - min(1, c * (1 - k) + k)) * 255;\n const g = (1 - min(1, m * (1 - k) + k)) * 255;\n const b = (1 - min(1, y * (1 - k) + k)) * 255;\n\n return [...rgbToHsv(r, g, b)];\n}\n\n/**\n * Convert HSL to HSV.\n * @param h Hue\n * @param s Saturation\n * @param l Lightness\n * @return {number[]} HSV values.\n */\nfunction hslToHsv(h, s, l) {\n s /= 100;\n l /= 100;\n s *= l < 0.5 ? l : 1 - l;\n\n let ns = (2 * s / (l + s)) * 100;\n let v = (l + s) * 100;\n return [h, ns, v];\n}\n\n/**\n * Convert HEX to HSV.\n * @param hex Hexadecimal string of rgb colors, can have length 3 or 6.\n * @return {number[]} HSV values.\n */\nfunction hexToHsv(hex) {\n return rgbToHsv(...hex.match(/.{2}/g).map(v => parseInt(v, 16)));\n}\n\n/**\n * Try's to parse a string which represents a color to a HSV array.\n * Current supported types are cmyk, rgba, hsla and hexadecimal.\n * @param str\n * @return {*}\n */\nexport function parseToHSV(str) {\n\n // Check if string is a color-name\n str = str.match(/^[a-zA-Z]+$/) ? standardizeColor(str) : str;\n\n // Regular expressions to match different types of color represention\n const regex = {\n cmyk: /^cmyk[\\D]+(\\d+)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]+(\\d+)/i,\n rgba: /^(rgb|rgba)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]*?([\\d.]+|$)/i,\n hsla: /^(hsl|hsla)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]*?([\\d.]+|$)/i,\n hsva: /^(hsv|hsva)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]*?([\\d.]+|$)/i,\n hex: /^#?(([\\dA-Fa-f]{3,4})|([\\dA-Fa-f]{6})|([\\dA-Fa-f]{8}))$/i\n };\n\n /**\n * Takes an Array of any type, convert strings which represents\n * a number to a number an anything else to undefined.\n * @param array\n * @return {*}\n */\n const numarize = array => array.map(Number);\n\n let match;\n invalid: for (const type in regex) {\n\n // Check if current scheme passed\n if (!(match = regex[type].exec(str)))\n continue;\n\n // Try to convert\n switch (type) {\n case 'cmyk': {\n let [, c, m, y, k] = numarize(match);\n\n if (c > 100 || m > 100 || y > 100 || k > 100)\n break invalid;\n\n return {values: [...cmykToHsv(c, m, y, k), 1], type};\n }\n case 'rgba': {\n let [, , r, g, b, a = 1] = numarize(match);\n\n if (r > 255 || g > 255 || b > 255 || a < 0 || a > 1)\n break invalid;\n\n return {values: [...rgbToHsv(r, g, b), a], type};\n }\n case 'hex': {\n let [, hex] = match;\n\n if (hex.length === 4 || hex.length === 3) {\n hex = hex.split('').map(v => v + v).join('');\n }\n\n if (hex.length === 6) {\n hex += 'ff';\n }\n\n let [raw, alpha] = [hex.substring(0, 6), hex.substring(6)];\n\n // Convert 0 - 255 to 0 - 1 for opacity\n alpha = parseInt(alpha, 16) / 255;\n return {values: [...hexToHsv(raw), alpha], type};\n }\n case 'hsla': {\n let [, , h, s, l, a = 1] = numarize(match);\n\n if (h > 360 || s > 100 || l > 100 || a < 0 || a > 1)\n break invalid;\n\n return {values: [...hslToHsv(h, s, l), a], type};\n }\n case 'hsva': {\n let [, , h, s, v, a = 1] = numarize(match);\n\n if (h > 360 || s > 100 || v > 100 || a < 0 || a > 1)\n break invalid;\n\n return {values: [h, s, v, a], type};\n }\n }\n }\n\n return {values: null, type: null};\n}\n","import {hsvToHsl, hsvToRgb, hsvToCmyk, hsvToHex} from './color';\n\n/**\n * Simple class which holds the properties\n * of the color represention model hsla (hue saturation lightness alpha)\n */\nexport function HSVaColor(h = 0, s = 0, v = 0, a = 1) {\n\n const that = {\n h, s, v, a,\n\n toHSVA() {\n const hsva = [that.h, that.s, that.v, that.a];\n hsva.toString = () => `hsva(${that.h}, ${that.s}%, ${that.v}%, ${that.a})`;\n return hsva;\n },\n\n toHSLA() {\n const hsla = [...hsvToHsl(that.h, that.s, that.v), that.a];\n hsla.toString = () => `hsla(${hsla[0]}, ${hsla[1]}%, ${hsla[2]}%, ${hsla[3].toFixed(1)})`;\n return hsla;\n },\n\n toRGBA() {\n const rgba = [...hsvToRgb(that.h, that.s, that.v), that.a];\n rgba.toString = () => `rgba(${rgba[0]}, ${rgba[1]}, ${rgba[2]}, ${rgba[3].toFixed(1)})`;\n return rgba;\n },\n\n toCMYK() {\n const cmyk = hsvToCmyk(that.h, that.s, that.v);\n cmyk.toString = () => `cmyk(${cmyk[0]}%, ${cmyk[1]}%, ${cmyk[2]}%, ${cmyk[3]}%)`;\n return cmyk;\n },\n\n toHEXA() {\n const hex = hsvToHex(that.h, that.s, that.v);\n\n // Check if alpha channel make sense, convert it to 255 number space, convert\n // to hex and pad it with zeros if needet.\n const alpha = that.a >= 1 ? '' : Number((that.a * 255).toFixed(0))\n .toString(16)\n .toUpperCase().padStart(2, '0');\n\n alpha && hex.push(alpha);\n hex.toString = () => `#${hex.join('').toUpperCase()}`;\n return hex;\n },\n\n clone: () => HSVaColor(that.h, that.s, that.v, that.a)\n };\n\n return that;\n}\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\r\n if (that.options.lock === 'h') {\r\n y = x;\r\n }\r\n\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 {parseToHSV} 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 // If the current color value should be recalculated\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 theme: 'classic',\n useAsButton: false,\n disabled: false,\n comparison: true,\n closeOnScroll: false,\n\n components: {\n interaction: {}\n },\n\n strings: {},\n swatches: null,\n inline: false,\n sliders: null,\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, theme, sliders} = opt;\n\n if (['nano', 'monolith'].includes(theme) && !sliders) {\n opt.sliders = 'h';\n }\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 cs = this.options.components;\n const [so, sh] = (() => {\n const {sliders} = inst.options;\n let so = 'v', sh = 'v';\n\n if (sliders && 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 (!cs.palette) return;\n const {_color, _root, options} = inst;\n\n // Update the input field only if the user is currently not typing\n if (inst._recalc) {\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 inst._updateOutput();\n }\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 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 (!cs.hue || !cs.palette) return;\n\n // Calculate hue\n if (inst._recalc) {\n inst._color.h = v * 360;\n }\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 (!cs.opacity || !cs.palette) return;\n\n // Calculate opacity\n if (inst._recalc) {\n inst._color.a = Math.round(v * 1e2) / 100;\n }\n\n // Update color\n this.element.style.background = `rgba(0, 0, 0, ${inst._color.a})`;\n 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([\n _root.interaction.cancel,\n _root.preview.lastColor\n ], '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\n if (options.closeOnScroll) {\n that.hide();\n }\n\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 }, {capture: true})\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(silent = false) {\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 && !silent) {\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} = 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
\n
\n \n
\n
\n\n
\n
\n
\n
\n\n
\n
\n
\n
\n\n
\n
\n
\n
\n
\n\n
\n\n
\n \n\n \n \n \n \n \n\n \n \n \n
\n
\n \n `);\n\n const int = root.interaction;\n\n // Select option which is not hidden\n int.options.find(o => !o.hidden && !o.classList.add('active'));\n\n // Create method to find currenlty active option\n int.type = () => int.options.find(e => e.classList.contains('active'));\n return root;\n}\n"],"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","invalid","type","exec","_numarize2","_slicedToArray","values","concat","_numarize4","_numarize4$","a","split","join","_ref","substring","raw","alpha","_numarize6","_numarize6$","_numarize8","_numarize8$","HSVaColor","that","toHSVA","toString","toHSLA","hsvacolor_toConsumableArray","hsvToHsl","toFixed","toRGBA","toCMYK","rgb","hsvToCmyk","toHEXA","padStart","hsvToHex","toUpperCase","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","theme","useAsButton","disabled","comparison","closeOnScroll","components","interaction","strings","swatches","inline","sliders","default","defaultRepresentation","position","adjustableNumbers","showAlways","closeWithKey","_opt","includes","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","_pos$split2$","variant","isVertical","_getInfo","rb","eb","so","total","scrollTop","getScrollOffset","variants","vertical","bevs","vars","styleprop","adder","win","_i2","_arr2","rot","v2Ok","v1Ok","requestAnimationFrame","cb","offsetParent","body","setColor","_rePositioningPicker","_representation","setColorRepresentation","show","_initializingActive","_emit","hidden","int","reduce","pv","cv","ci","querySelector","shadowRoot","keys","input","cancel","clear","find","add","contains","appendChild","removeChild","lastChild","insertBefore","nextSibling","parentNode","replaceChild","disable","transition","lastColor","hide","inst","cs","sh","_sliders","pickr_slicedToArray","opposite","_ref2","picker","_color","_recalc","_updateOutput","cssRGBaString","background","currentColor","remove","slider","backgroundColor","selectable","_components","_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","silent","event","_this3","_len","args","_key","_eventListener","callBacks","indexOf","splice","_this4","_swatchColors","hsvaColorObject","swatchColor","_this$_root","_this5","_this6","_this$_root2","recalc","_this$_components","string","_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,eAAAnB,EAAA,cAAiDyB,OAAA,KAQjDnB,EAAAoB,EAAA,SAAAD,EAAAE,GAEA,GADA,EAAAA,IAAAF,EAAAnB,EAAAmB,IACA,EAAAE,EAAA,OAAAF,EACA,KAAAE,GAAA,iBAAAF,QAAAG,WAAA,OAAAH,EACA,IAAAI,EAAAX,OAAAY,OAAA,MAGA,GAFAxB,EAAAgB,EAAAO,GACAX,OAAAC,eAAAU,EAAA,WAAyCT,YAAA,EAAAK,UACzC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F,KAAK2H,yCAOZ,OAAO3H,KAAK4C,wCAUZ,OAHA5C,KAAKkH,OACLlH,KAAKlM,QAAQ4M,UAAW,EACxBV,KAAK4C,MAAMC,OAAOjD,UAAU0G,IAAI,YACzBtG,sCASP,OAFAA,KAAKlM,QAAQ4M,UAAW,EACxBV,KAAK4C,MAAMC,OAAOjD,UAAUqI,OAAO,YAC5BjI,0CAKfF,EAAM0L,MAAQxN,EAGd8B,EAAMjN,OAAS,SAAAiB,GAAO,OAAI,IAAIgM,EAAMhM,IAGpCgM,EAAM2L,QAAU,QACD3L","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\nconst {min, max, floor, round} = Math;\n\n/**\n * Tries to convert a color name to rgb/a hex representation\n * @param name\n * @returns {string | CanvasGradient | CanvasPattern}\n */\nfunction standardizeColor(name) {\n const ctx = document.createElement('canvas').getContext('2d');\n ctx.fillStyle = name;\n return ctx.fillStyle;\n}\n\n/**\n * Convert HSV spectrum to RGB.\n * @param h Hue\n * @param s Saturation\n * @param v Value\n * @returns {number[]} Array with rgb values.\n */\nexport function hsvToRgb(h, s, v) {\n h = (h / 360) * 6;\n s /= 100;\n v /= 100;\n\n let i = floor(h);\n\n let f = h - i;\n let p = v * (1 - s);\n let q = v * (1 - f * s);\n let t = v * (1 - (1 - f) * s);\n\n let mod = i % 6;\n let r = [v, q, p, p, t, v][mod];\n let g = [t, v, v, q, p, p][mod];\n let b = [p, p, t, v, v, q][mod];\n\n return [\n r * 255,\n g * 255,\n b * 255\n ];\n}\n\n/**\n * Convert HSV spectrum to Hex.\n * @param h Hue\n * @param s Saturation\n * @param v Value\n * @returns {string[]} Hex values\n */\nexport function hsvToHex(h, s, v) {\n return hsvToRgb(h, s, v).map(v =>\n round(v).toString(16).padStart(2, '0')\n );\n}\n\n/**\n * Convert HSV spectrum to CMYK.\n * @param h Hue\n * @param s Saturation\n * @param v Value\n * @returns {number[]} CMYK values\n */\nexport function hsvToCmyk(h, s, v) {\n const rgb = hsvToRgb(h, s, v);\n const r = rgb[0] / 255;\n const g = rgb[1] / 255;\n const b = rgb[2] / 255;\n\n let k, c, m, y;\n\n k = min(1 - r, 1 - g, 1 - b);\n\n c = k === 1 ? 0 : (1 - r - k) / (1 - k);\n m = k === 1 ? 0 : (1 - g - k) / (1 - k);\n y = k === 1 ? 0 : (1 - b - k) / (1 - k);\n\n return [\n c * 100,\n m * 100,\n y * 100,\n k * 100\n ];\n}\n\n/**\n * Convert HSV spectrum to HSL.\n * @param h Hue\n * @param s Saturation\n * @param v Value\n * @returns {number[]} HSL values\n */\nexport function hsvToHsl(h, s, v) {\n s /= 100, v /= 100;\n\n let l = (2 - s) * v / 2;\n\n if (l !== 0) {\n if (l === 1) {\n s = 0;\n } else if (l < 0.5) {\n s = s * v / (l * 2);\n } else {\n s = s * v / (2 - l * 2);\n }\n }\n\n return [\n h,\n s * 100,\n l * 100\n ];\n}\n\n/**\n * Convert RGB to HSV.\n * @param r Red\n * @param g Green\n * @param b Blue\n * @return {number[]} HSV values.\n */\nfunction rgbToHsv(r, g, b) {\n r /= 255, g /= 255, b /= 255;\n\n let h, s, v;\n const minVal = min(r, g, b);\n const maxVal = max(r, g, b);\n const delta = maxVal - minVal;\n\n v = maxVal;\n if (delta === 0) {\n h = s = 0;\n } else {\n s = delta / maxVal;\n let dr = (((maxVal - r) / 6) + (delta / 2)) / delta;\n let dg = (((maxVal - g) / 6) + (delta / 2)) / delta;\n let db = (((maxVal - b) / 6) + (delta / 2)) / delta;\n\n if (r === maxVal) {\n h = db - dg;\n } else if (g === maxVal) {\n h = (1 / 3) + dr - db;\n } else if (b === maxVal) {\n h = (2 / 3) + dg - dr;\n }\n\n if (h < 0) {\n h += 1;\n } else if (h > 1) {\n h -= 1;\n }\n }\n\n return [\n h * 360,\n s * 100,\n v * 100\n ];\n}\n\n/**\n * Convert CMYK to HSV.\n * @param c Cyan\n * @param m Magenta\n * @param y Yellow\n * @param k Key (Black)\n * @return {number[]} HSV values.\n */\nfunction cmykToHsv(c, m, y, k) {\n c /= 100;\n m /= 100;\n y /= 100;\n k /= 100;\n\n const r = (1 - min(1, c * (1 - k) + k)) * 255;\n const g = (1 - min(1, m * (1 - k) + k)) * 255;\n const b = (1 - min(1, y * (1 - k) + k)) * 255;\n\n return [...rgbToHsv(r, g, b)];\n}\n\n/**\n * Convert HSL to HSV.\n * @param h Hue\n * @param s Saturation\n * @param l Lightness\n * @return {number[]} HSV values.\n */\nfunction hslToHsv(h, s, l) {\n s /= 100;\n l /= 100;\n s *= l < 0.5 ? l : 1 - l;\n\n let ns = (2 * s / (l + s)) * 100;\n let v = (l + s) * 100;\n return [h, ns, v];\n}\n\n/**\n * Convert HEX to HSV.\n * @param hex Hexadecimal string of rgb colors, can have length 3 or 6.\n * @return {number[]} HSV values.\n */\nfunction hexToHsv(hex) {\n return rgbToHsv(...hex.match(/.{2}/g).map(v => parseInt(v, 16)));\n}\n\n/**\n * Try's to parse a string which represents a color to a HSV array.\n * Current supported types are cmyk, rgba, hsla and hexadecimal.\n * @param str\n * @return {*}\n */\nexport function parseToHSV(str) {\n\n // Check if string is a color-name\n str = str.match(/^[a-zA-Z]+$/) ? standardizeColor(str) : str;\n\n // Regular expressions to match different types of color represention\n const regex = {\n cmyk: /^cmyk[\\D]+(\\d+)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]+(\\d+)/i,\n rgba: /^(rgb|rgba)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]*?([\\d.]+|$)/i,\n hsla: /^(hsl|hsla)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]*?([\\d.]+|$)/i,\n hsva: /^(hsv|hsva)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]*?([\\d.]+|$)/i,\n hex: /^#?(([\\dA-Fa-f]{3,4})|([\\dA-Fa-f]{6})|([\\dA-Fa-f]{8}))$/i\n };\n\n /**\n * Takes an Array of any type, convert strings which represents\n * a number to a number an anything else to undefined.\n * @param array\n * @return {*}\n */\n const numarize = array => array.map(Number);\n\n let match;\n invalid: for (const type in regex) {\n\n // Check if current scheme passed\n if (!(match = regex[type].exec(str)))\n continue;\n\n // Try to convert\n switch (type) {\n case 'cmyk': {\n let [, c, m, y, k] = numarize(match);\n\n if (c > 100 || m > 100 || y > 100 || k > 100)\n break invalid;\n\n return {values: [...cmykToHsv(c, m, y, k), 1], type};\n }\n case 'rgba': {\n let [, , r, g, b, a = 1] = numarize(match);\n\n if (r > 255 || g > 255 || b > 255 || a < 0 || a > 1)\n break invalid;\n\n return {values: [...rgbToHsv(r, g, b), a], type};\n }\n case 'hex': {\n let [, hex] = match;\n\n if (hex.length === 4 || hex.length === 3) {\n hex = hex.split('').map(v => v + v).join('');\n }\n\n if (hex.length === 6) {\n hex += 'ff';\n }\n\n let [raw, alpha] = [hex.substring(0, 6), hex.substring(6)];\n\n // Convert 0 - 255 to 0 - 1 for opacity\n alpha = parseInt(alpha, 16) / 255;\n return {values: [...hexToHsv(raw), alpha], type};\n }\n case 'hsla': {\n let [, , h, s, l, a = 1] = numarize(match);\n\n if (h > 360 || s > 100 || l > 100 || a < 0 || a > 1)\n break invalid;\n\n return {values: [...hslToHsv(h, s, l), a], type};\n }\n case 'hsva': {\n let [, , h, s, v, a = 1] = numarize(match);\n\n if (h > 360 || s > 100 || v > 100 || a < 0 || a > 1)\n break invalid;\n\n return {values: [h, s, v, a], type};\n }\n }\n }\n\n return {values: null, type: null};\n}\n","import {hsvToHsl, hsvToRgb, hsvToCmyk, hsvToHex} from './color';\n\n/**\n * Simple class which holds the properties\n * of the color represention model hsla (hue saturation lightness alpha)\n */\nexport function HSVaColor(h = 0, s = 0, v = 0, a = 1) {\n\n const that = {\n h, s, v, a,\n\n toHSVA() {\n const hsva = [that.h, that.s, that.v, that.a];\n hsva.toString = () => `hsva(${that.h}, ${that.s}%, ${that.v}%, ${that.a})`;\n return hsva;\n },\n\n toHSLA() {\n const hsla = [...hsvToHsl(that.h, that.s, that.v), that.a];\n hsla.toString = () => `hsla(${hsla[0]}, ${hsla[1]}%, ${hsla[2]}%, ${hsla[3].toFixed(1)})`;\n return hsla;\n },\n\n toRGBA() {\n const rgba = [...hsvToRgb(that.h, that.s, that.v), that.a];\n rgba.toString = () => `rgba(${rgba[0]}, ${rgba[1]}, ${rgba[2]}, ${rgba[3].toFixed(1)})`;\n return rgba;\n },\n\n toCMYK() {\n const cmyk = hsvToCmyk(that.h, that.s, that.v);\n cmyk.toString = () => `cmyk(${cmyk[0]}%, ${cmyk[1]}%, ${cmyk[2]}%, ${cmyk[3]}%)`;\n return cmyk;\n },\n\n toHEXA() {\n const hex = hsvToHex(that.h, that.s, that.v);\n\n // Check if alpha channel make sense, convert it to 255 number space, convert\n // to hex and pad it with zeros if needet.\n const alpha = that.a >= 1 ? '' : Number((that.a * 255).toFixed(0))\n .toString(16)\n .toUpperCase().padStart(2, '0');\n\n alpha && hex.push(alpha);\n hex.toString = () => `#${hex.join('').toUpperCase()}`;\n return hex;\n },\n\n clone: () => HSVaColor(that.h, that.s, that.v, that.a)\n };\n\n return that;\n}\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\r\n if (that.options.lock === 'h') {\r\n y = x;\r\n }\r\n\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 {parseToHSV} 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 // If the current color value should be recalculated\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 theme: 'classic',\n useAsButton: false,\n disabled: false,\n comparison: true,\n closeOnScroll: false,\n\n components: {\n interaction: {}\n },\n\n strings: {},\n swatches: null,\n inline: false,\n sliders: null,\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, theme, sliders} = opt;\n\n if (['nano', 'monolith'].includes(theme) && !sliders) {\n opt.sliders = 'h';\n }\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 cs = this.options.components;\n const [so, sh] = (() => {\n const {sliders} = inst.options;\n let so = 'v', sh = 'v';\n\n if (sliders && 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 (!cs.palette) return;\n const {_color, _root, options} = inst;\n\n // Update the input field only if the user is currently not typing\n if (inst._recalc) {\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 inst._updateOutput();\n }\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 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 (!cs.hue || !cs.palette) return;\n\n // Calculate hue\n if (inst._recalc) {\n inst._color.h = v * 360;\n }\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 (!cs.opacity || !cs.palette) return;\n\n // Calculate opacity\n if (inst._recalc) {\n inst._color.a = Math.round(v * 1e2) / 100;\n }\n\n // Update color\n this.element.style.background = `rgba(0, 0, 0, ${inst._color.a})`;\n 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([\n _root.interaction.cancel,\n _root.preview.lastColor\n ], '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\n if (options.closeOnScroll) {\n that.hide();\n }\n\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 }, {capture: true})\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(silent = false) {\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 && !silent) {\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} = 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
\n
\n \n
\n
\n\n
\n
\n
\n
\n\n
\n
\n
\n
\n\n
\n
\n
\n
\n
\n\n
\n\n
\n \n\n \n \n \n \n \n\n \n \n \n
\n
\n \n `);\n\n const int = root.interaction;\n\n // Select option which is not hidden\n int.options.find(o => !o.hidden && !o.classList.add('active'));\n\n // Create method to find currenlty active option\n int.type = () => int.options.find(e => e.classList.contains('active'));\n return root;\n}\n"],"sourceRoot":""} \ No newline at end of file diff --git a/dist/pickr.min.js b/dist/pickr.min.js index 6ca75098..94cc1e91 100644 --- a/dist/pickr.min.js +++ b/dist/pickr.min.js @@ -1,3 +1,3 @@ -/*! Pickr 1.0.1 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,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=(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]}function _(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 w(t,e,n,o){return e/=100,n/=100,[..._(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 k(t,e,n){return e/=100,[t,2*(e*=(n/=100)<.5?n:1-n)/(n+e)*100,100*(n+e)]}function A(t){return _(...t.match(/.{2}/g).map(t=>parseInt(t,16)))}function C(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(Number);let o;t: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 t;return{values:[...w(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 t;return{values:[..._(t,e,r),s],type:i}}case"hex":{let[,t]=o;4!==t.length&&3!==t.length||(t=t.split("").map(t=>t+t).join("")),6===t.length&&(t+="ff");let[e,n]=[t.substring(0,6),t.substring(6)];return n=parseInt(n,16)/255,{values:[...A(e),n],type:i}}case"hsla":{let[,,t,e,r,s=1]=n(o);if(t>360||e>100||r>100||s<0||s>1)break t;return{values:[...k(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 t;return{values:[t,e,r,s],type:i}}}return{values:null,type:null}}function S(t=0,e=0,n=0,o=1){const i={h:t,s:e,v:n,a:o,toHSVA(){const t=[i.h,i.s,i.v,i.a];return t.toString=()=>"hsva(".concat(i.h,", ").concat(i.s,"%, ").concat(i.v,"%, ").concat(i.a,")"),t},toHSLA(){const t=[...g(i.h,i.s,i.v),i.a];return t.toString=()=>"hsla(".concat(t[0],", ").concat(t[1],"%, ").concat(t[2],"%, ").concat(t[3].toFixed(1),")"),t},toRGBA(){const t=[...b(i.h,i.s,i.v),i.a];return t.toString=()=>"rgba(".concat(t[0],", ").concat(t[1],", ").concat(t[2],", ").concat(t[3].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,u;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*(u=1===a?0:(1-s-a)/(1-a)),100*a]}(i.h,i.s,i.v);return t.toString=()=>"cmyk(".concat(t[0],"%, ").concat(t[1],"%, ").concat(t[2],"%, ").concat(t[3],"%)"),t},toHEXA(){const t=function(t,e,n){return b(t,e,n).map(t=>y(t).toString(16).padStart(2,"0"))}(i.h,i.s,i.v),e=i.a>=1?"":Number((255*i.a).toFixed(0)).toString(16).toUpperCase().padStart(2,"0");return e&&t.push(e),t.toString=()=>"#".concat(t.join("").toUpperCase()),t},clone:()=>S(i.h,i.s,i.v,i.a)};return i}const O=t=>Math.max(Math.min(t,1),0);function j(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 u=O(c/s.offsetWidth),p=O(l/s.offsetHeight);switch(o){case"v":return n.onchange(u);case"h":return n.onchange(p);default:return n.onchange(u,p)}},_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();"h"===e.options.lock&&(n=t),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 E=({components:t,strings:e,useAsButton:n,inline:o,appClass:i,theme:r})=>{const s=t=>t?"":'style="display:none" hidden',a=p('\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
\n ")),c=a.interaction;return c.options.find(t=>!t.hidden&&!t.classList.add("active")),c.type=()=>c.options.find(t=>t.classList.contains("active")),a};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 L{constructor(t){B(this,"_initializingActive",!0),B(this,"_recalc",!0),B(this,"_color",S()),B(this,"_lastColor",S()),B(this,"_swatchColors",[]),B(this,"_eventListener",{swatchselect:[],change:[],save:[],init:[]}),this.options=t=Object.assign({appClass:null,theme:"classic",useAsButton:!1,disabled:!1,comparison:!0,closeOnScroll:!1,components:{interaction:{}},strings:{},swatches:null,inline:!1,sliders:null,default:"#42445a",defaultRepresentation:null,position:"bottom-middle",adjustableNumbers:!0,showAlways:!1,closeWithKey:"Escape"},t);const{swatches:e,inline:n,components:o,theme:i,sliders:r}=t;["nano","monolith"].includes(i)&&!r&&(t.sliders="h"),o.interaction||(o.interaction={});const{preview:s,opacity:a,hue:c,palette:l}=o;o.palette=l||s||a||c,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:"tbrl",right:"rltb",bottom:"btrl",left:"lrbt"},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),u=e.getBoundingClientRect(),p=t.getBoundingClientRect(),h=((t,e=0)=>{for(;t=t.parentElement;)e+=t.scrollTop;return e})(t),d=t=>t?{t:u.top-p.height-n,b:u.bottom+n+h}:{r:u.right+n,l:u.left-p.width-n},f=t=>t?{s:u.left+u.width-p.width,m:-p.width/2+(u.left+u.width/2),e:u.left}:{s:u.bottom-p.height,m:u.bottom-u.height/2-p.height/2,e:u.bottom-u.height};function m(e,n,o){const i="top"===o,r=i?p.height:p.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&&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:j({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;t._recalc&&(i.s=100*n,i.v=100-100*o,i.v<0&&(i.v=0),t._updateOutput());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.options.comparison||r.button.classList.remove("clear")}}),hue:j({lock:o,element:t._root.hue.picker,wrapper:t._root.hue.slider,onchange(n){e.hue&&e.palette&&(t._recalc&&(t._color.h=360*n),this.element.style.backgroundColor="hsl(".concat(t._color.h,", 100%, 50%)"),i.palette.trigger())}}),opacity:j({lock:n,element:t._root.opacity.picker,wrapper:t._root.opacity.slider,onchange(n){e.opacity&&e.palette&&(t._recalc&&(t._color.a=Math.round(100*n)/100),this.element.style.background="rgba(0, 0, 0, ".concat(t._color.a,")"),i.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.interaction.cancel,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{o.isOpen()&&(e.closeOnScroll&&o.hide(),null===t?(t=setTimeout(()=>t=null,100),requestAnimationFrame(function e(){o._rePositioningPicker(),null!==t&&requestAnimationFrame(e)})):(clearTimeout(t),t=setTimeout(()=>t=null,100)))},{capture:!0}))}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(t=!1){const{_root:e,options:n}=this;n.useAsButton||(e.button.style.color="rgba(0, 0, 0, 0.15)"),e.button.classList.add("clear"),n.showAlways||this.hide(),this._initializingActive||t||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}=C(t);if(e){const{_swatchColors:t,_root:n}=this,o=S(...e),i=l('','\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 ")),c=a.interaction;return c.options.find(t=>!t.hidden&&!t.classList.add("active")),c.type=()=>c.options.find(t=>t.classList.contains("active")),a};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 L{constructor(t){B(this,"_initializingActive",!0),B(this,"_recalc",!0),B(this,"_color",S()),B(this,"_lastColor",S()),B(this,"_swatchColors",[]),B(this,"_eventListener",{swatchselect:[],change:[],save:[],init:[]}),this.options=t=Object.assign({appClass:null,theme:"classic",useAsButton:!1,disabled:!1,comparison:!0,closeOnScroll:!1,components:{interaction:{}},strings:{},swatches:null,inline:!1,sliders:null,default:"#42445a",defaultRepresentation:null,position:"bottom-middle",adjustableNumbers:!0,showAlways:!1,closeWithKey:"Escape"},t);const{swatches:e,inline:n,components:o,theme:i,sliders:r}=t;["nano","monolith"].includes(i)&&!r&&(t.sliders="h"),o.interaction||(o.interaction={});const{preview:s,opacity:a,hue:c,palette:l}=o;o.palette=l||s||a||c,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:"tbrl",right:"rltb",bottom:"btrl",left:"lrbt"},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),u=e.getBoundingClientRect(),p=t.getBoundingClientRect(),h=((t,e=0)=>{for(;t=t.parentElement;)e+=t.scrollTop;return e})(t),d=t=>t?{t:u.top-p.height-n,b:u.bottom+n+h}:{r:u.right+n,l:u.left-p.width-n},f=t=>t?{s:u.left+u.width-p.width,m:-p.width/2+(u.left+u.width/2),e:u.left}:{s:u.bottom-p.height,m:u.bottom-u.height/2-p.height/2,e:u.bottom-u.height};function m(e,n,o){const i="top"===o,r=i?p.height:p.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&&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:j({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;t._recalc&&(i.s=100*n,i.v=100-100*o,i.v<0&&(i.v=0),t._updateOutput());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.options.comparison||r.button.classList.remove("clear")}}),hue:j({lock:o,element:t._root.hue.picker,wrapper:t._root.hue.slider,onchange(n){e.hue&&e.palette&&(t._recalc&&(t._color.h=360*n),this.element.style.backgroundColor="hsl(".concat(t._color.h,", 100%, 50%)"),i.palette.trigger())}}),opacity:j({lock:n,element:t._root.opacity.picker,wrapper:t._root.opacity.slider,onchange(n){e.opacity&&e.palette&&(t._recalc&&(t._color.a=Math.round(100*n)/100),this.element.style.background="rgba(0, 0, 0, ".concat(t._color.a,")"),i.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.interaction.cancel,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{o.isOpen()&&(e.closeOnScroll&&o.hide(),null===t?(t=setTimeout(()=>t=null,100),requestAnimationFrame(function e(){o._rePositioningPicker(),null!==t&&requestAnimationFrame(e)})):(clearTimeout(t),t=setTimeout(()=>t=null,100)))},{capture:!0}))}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(t=!1){const{_root:e,options:n}=this;n.useAsButton||(e.button.style.color="rgba(0, 0, 0, 0.15)"),e.button.classList.add("clear"),n.showAlways||this.hide(),this._initializingActive||t||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}=C(t);if(e){const{_swatchColors:t,_root:n}=this,o=S(...e),i=l(''}\n\n
\n
\n
\n \n
\n
\n\n
\n
\n
\n
\n\n
\n
\n
\n
\n\n
\n
\n
\n
\n
\n\n
\n\n
\n \n\n \n \n \n \n \n\n \n \n \n
\n
\n \n `);\n\n const int = root.interaction;\n\n // Select option which is not hidden\n int.options.find(o => !o.hidden && !o.classList.add('active'));\n\n // Create method to find currenlty active option\n int.type = () => int.options.find(e => e.classList.contains('active'));\n return root;\n}\n","// Import utils\nimport * as _ from './utils/utils';\nimport {parseToHSV} 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 // If the current color value should be recalculated\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 theme: 'classic',\n useAsButton: false,\n disabled: false,\n comparison: true,\n closeOnScroll: false,\n\n components: {\n interaction: {}\n },\n\n strings: {},\n swatches: null,\n inline: false,\n sliders: null,\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, theme, sliders} = opt;\n\n if (['nano', 'monolith'].includes(theme) && !sliders) {\n opt.sliders = 'h';\n }\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 cs = this.options.components;\n const [so, sh] = (() => {\n const {sliders} = inst.options;\n let so = 'v', sh = 'v';\n\n if (sliders && 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 (!cs.palette) return;\n const {_color, _root, options} = inst;\n\n // Update the input field only if the user is currently not typing\n if (inst._recalc) {\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 inst._updateOutput();\n }\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 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 (!cs.hue || !cs.palette) return;\n\n // Calculate hue\n if (inst._recalc) {\n inst._color.h = v * 360;\n }\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 (!cs.opacity || !cs.palette) return;\n\n // Calculate opacity\n if (inst._recalc) {\n inst._color.a = Math.round(v * 1e2) / 100;\n }\n\n // Update color\n this.element.style.background = `rgba(0, 0, 0, ${inst._color.a})`;\n 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([\n _root.interaction.cancel,\n _root.preview.lastColor\n ], '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\n if (options.closeOnScroll) {\n that.hide();\n }\n\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 }, {capture: true})\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(silent = false) {\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 && !silent) {\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} = 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
\n
\n \n
\n
\n\n
\n
\n
\n
\n\n
\n
\n
\n
\n\n
\n
\n
\n
\n
\n\n
\n\n
\n \n\n \n \n \n \n \n\n \n \n \n
\n
\n \n `);\n\n const int = root.interaction;\n\n // Select option which is not hidden\n int.options.find(o => !o.hidden && !o.classList.add('active'));\n\n // Create method to find currenlty active option\n int.type = () => int.options.find(e => e.classList.contains('active'));\n return root;\n}\n","// Import utils\nimport * as _ from './utils/utils';\nimport {parseToHSV} 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 // If the current color value should be recalculated\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 theme: 'classic',\n useAsButton: false,\n disabled: false,\n comparison: true,\n closeOnScroll: false,\n\n components: {\n interaction: {}\n },\n\n strings: {},\n swatches: null,\n inline: false,\n sliders: null,\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, theme, sliders} = opt;\n\n if (['nano', 'monolith'].includes(theme) && !sliders) {\n opt.sliders = 'h';\n }\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 cs = this.options.components;\n const [so, sh] = (() => {\n const {sliders} = inst.options;\n let so = 'v', sh = 'v';\n\n if (sliders && 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 (!cs.palette) return;\n const {_color, _root, options} = inst;\n\n // Update the input field only if the user is currently not typing\n if (inst._recalc) {\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 inst._updateOutput();\n }\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 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 (!cs.hue || !cs.palette) return;\n\n // Calculate hue\n if (inst._recalc) {\n inst._color.h = v * 360;\n }\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 (!cs.opacity || !cs.palette) return;\n\n // Calculate opacity\n if (inst._recalc) {\n inst._color.a = Math.round(v * 1e2) / 100;\n }\n\n // Update color\n this.element.style.background = `rgba(0, 0, 0, ${inst._color.a})`;\n 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([\n _root.interaction.cancel,\n _root.preview.lastColor\n ], '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\n if (options.closeOnScroll) {\n that.hide();\n }\n\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 }, {capture: true})\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(silent = false) {\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 && !silent) {\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} = 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 `