From 2922c77256284ac99db730cae954dd7823813ec4 Mon Sep 17 00:00:00 2001 From: Simon Date: Mon, 17 Jun 2019 18:17:13 +0200 Subject: [PATCH] Publish 1.0.0 --- README.md | 2 +- dist/pickr.es5.min.js | 4 ++-- dist/pickr.es5.min.js.map | 2 +- dist/pickr.min.css | 2 +- dist/pickr.min.js | 4 ++-- dist/pickr.min.js.map | 2 +- dist/pickr.monolith.min.css | 2 +- dist/pickr.nano.min.css | 2 +- package-lock.json | 2 +- package.json | 2 +- src/js/pickr.js | 2 +- 11 files changed, 13 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index d52a435c..e4e95b0d 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.0.0-f1c40f.svg?style=popout-square"> Support me diff --git a/dist/pickr.es5.min.js b/dist/pickr.es5.min.js index 7628fc69..b86a3b79 100644 --- a/dist/pickr.es5.min.js +++ b/dist/pickr.es5.min.js @@ -1,3 +1,3 @@ -/*! Pickr 1.0.0-beta 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(function(t){return/^(|\d+)\.\d+|\d+$/.test(t)?Number(t):void 0})};for(var a in o)if(r=o[a].exec(t))switch(a){case"cmyk":var c=f(i(r),5),l=c[1],s=c[2],u=c[3],p=c[4];if(l>100||s>100||u>100||p>100)break;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;return{values:[].concat(v(w(d,y,m)),[b]),type:a};case"hex":var _=function(t,e){return[t.substring(0,e),t.substring(e,t.length)]},S=f(r,2)[1];3===S.length?S+="F":6===S.length&&(S+="FF");var O=void 0;if(4===S.length){var j=f(_(S,3).map(function(t){return t+t}),2);S=j[0],O=j[1]}else if(8===S.length){var x=f(_(S,6),2);S=x[0],O=x[1]}return O=parseInt(O,16)/255,{values:[].concat(v(C(S)),[O]),type:a};case"hsla":var E=f(i(r),6),P=E[2],B=E[3],L=E[4],R=E[5],H=void 0===R?1:R;if(P>360||B>100||L>100||H<0||H>1)break;return{values:[].concat(v(A(P,B,L)),[H]),type:a};case"hsva":var D=f(i(r),6),M=D[2],F=D[3],T=D[4],N=D[5],V=void 0===N?1:N;if(M>360||F>100||T>100||V<0||V>1)break;return{values:[M,F,T,V],type:a}}return{values:null,type:null}}function O(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,o=Math.ceil,i={h:t,s:e,v:n,a:r,toHSVA:function(){var t=[i.h,i.s,i.v],e=t.map(o);return t.push(i.a),t.toString=function(){return"hsva(".concat(e[0],", ").concat(e[1],"%, ").concat(e[2],"%, ").concat(i.a.toFixed(1),")")},t},toHSLA:function(){var t=function(t,e,n){var r=(2-(e/=100))*(n/=100)/2;return 0!==r&&(e=1===r?0:r<.5?e*n/(2*r):e*n/(2-2*r)),[t,100*e,100*r]}(i.h,i.s,i.v),e=t.map(o);return t.push(i.a),t.toString=function(){return"hsla(".concat(e[0],", ").concat(e[1],"%, ").concat(e[2],"%, ").concat(i.a.toFixed(1),")")},t},toRGBA:function(){var t=_(i.h,i.s,i.v),e=t.map(o);return t.push(i.a),t.toString=function(){return"rgba(".concat(e[0],", ").concat(e[1],", ").concat(e[2],", ").concat(i.a.toFixed(1),")")},t},toCMYK:function(){var t=function(t,e,n){var r,o=_(t,e,n),i=o[0]/255,a=o[1]/255,c=o[2]/255;return[100*(1===(r=y(1-i,1-a,1-c))?0:(1-i-r)/(1-r)),100*(1===r?0:(1-a-r)/(1-r)),100*(1===r?0:(1-c-r)/(1-r)),100*r]}(i.h,i.s,i.v),e=t.map(o);return t.toString=function(){return"cmyk(".concat(e[0],"%, ").concat(e[1],"%, ").concat(e[2],"%, ").concat(e[3],"%)")},t},toHEXA:function(){var t=function(t,e,n){return _(t,e,n).map(function(t){return b(t).toString(16).padStart(2,"0")})}(i.h,i.s,i.v);return t.toString=function(){var e=i.a>=1?"":Number((255*i.a).toFixed(0)).toString(16).toUpperCase().padStart(2,"0");return"#".concat(t.join("").toUpperCase()+e)},t},clone:function(){return O(i.h,i.s,i.v,i.a)}};return i}var j=function(t){return Math.max(Math.min(t,1),0)};function x(t){var e={options:Object.assign({lock:null,onchange:function(){return 0}},t),_tapstart:function(t){a(document,["mouseup","touchend","touchcancel"],e._tapstop),a(document,["mousemove","touchmove"],e._tapmove),t.preventDefault(),e._tapmove(t)},_tapmove:function(t){var r=e.options.lock,o=e.cache,i=n.element,a=n.wrapper,c=a.getBoundingClientRect(),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=j(l/a.offsetWidth),h=j(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 E(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e0&&void 0!==arguments[0]?arguments[0]:{};t=Object.assign({onchange:function(){return 0},className:"",elements:[]},t);var e=a(t.elements,"click",function(e){t.elements.forEach(function(n){return n.classList[e.target===n?"add":"remove"](t.className)}),t.onchange(e)});return{destroy:function(){return c.apply(r,E(e))}}}function B(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=[],r=!0,o=!1,i=void 0;try{for(var a,c=t[Symbol.iterator]();!(r=(a=c.next()).done)&&(n.push(a.value),!e||n.length!==e);r=!0);}catch(t){o=!0,i=t}finally{try{r||null==c.return||c.return()}finally{if(o)throw i}}return n}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function L(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e0&&void 0!==arguments[0]?arguments[0]:{};return function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t[e];if(n)return n;var r=B(e.split("-"),2),o=r[0],i=r[1],a=void 0===i?"middle":i,c="top"===o||"bottom"===o;return t[e]={position:o,variant:a,isVertical:c}}}(),{update:function(t){var e=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=R(e,2);n=o[0],r=o[1]}else n=r=e;var i={v:"h",h:"v"};return[i[n],i[r]]}(),r=R(n,2),o=r[0],i=r[1],a={palette:x({element:t._root.palette.picker,wrapper:t._root.palette.palette,onchange:function(n,r){if(e.palette){var o=t._color,i=t._root,a=t.options;t._recalc&&(t._updateOutput(),o.s=100*n,o.v=100-100*r,o.v<0&&(o.v=0));var c=o.toRGBA().toString();this.element.style.background=c,this.wrapper.style.background="\n linear-gradient(to top, rgba(0, 0, 0, ".concat(o.a,"), transparent),\n linear-gradient(to left, hsla(").concat(o.h,", 100%, 50%, ").concat(o.a,"), rgba(255, 255, 255, ").concat(o.a,"))\n "),a.comparison||(i.button.style.color=c,a.useAsButton||(i.preview.lastColor.style.color=c)),i.preview.currentColor.style.color=c,t.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:P({elements:t._root.interaction.options,className:"active",onchange:function(e){t._representation=e.target.getAttribute("data-type").toUpperCase(),t._updateOutput()}})};this._components=a}},{key:"_bindEvents",value:function(){var t=this,e=this._root,n=this.options,r=[a(e.interaction.clear,"click",function(){return t._clearColor()}),a([e.interaction.cancel,e.preview.lastColor],"click",function(){return t.setHSVA.apply(t,L(t._lastColor.toHSVA()))}),a(e.interaction.save,"click",function(){!t.applyColor()&&!n.showAlways&&t.hide()}),a(e.interaction.result,["keyup","input"],function(e){t._recalc=!1,t.setColor(e.target.value,!0)&&!t._initializingActive&&t._emit("change",t._color),e.stopImmediatePropagation()}),a([e.palette.palette,e.palette.picker,e.hue.slider,e.hue.picker,e.opacity.slider,e.opacity.picker],["mousedown","touchstart"],function(){return t._recalc=!0})];if(!n.showAlways){var o=n.closeWithKey;r.push(a(e.button,"click",function(){return t.isOpen()?t.hide():t.show()}),a(document,"keyup",function(e){return t.isOpen()&&(e.key===o||e.code===o)&&t.hide()}),a(document,["touchstart","mousedown"],function(n){t.isOpen()&&!h(n).some(function(t){return t===e.app||t===e.button})&&t.hide()},{capture:!0}))}if(n.adjustableNumbers){var i={rgba:[255,255,255,1],hsva:[360,100,100,1],hsla:[360,100,100,1],cmyk:[100,100,100,100]};d(e.interaction.result,function(e,n,r){var o=i[t.getColorRepresentation().toLowerCase()];if(o){var a=o[r],c=e+(a>=100?1e3*n:n);return c<=0?0:Number((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,L(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,L(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=O(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(),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,L(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}}])&&H(e.prototype,n),o&&H(e,o),t}();M.utils=r,M.create=function(t){return new M(t)},M.version="1.0.0-beta";e.default=M}]).default}); +/*! Pickr 1.0.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(function(t){return/^(|\d+)\.\d+|\d+$/.test(t)?Number(t):void 0})};for(var a in o)if(r=o[a].exec(t))switch(a){case"cmyk":var c=f(i(r),5),l=c[1],s=c[2],u=c[3],p=c[4];if(l>100||s>100||u>100||p>100)break;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;return{values:[].concat(v(w(d,y,m)),[b]),type:a};case"hex":var _=function(t,e){return[t.substring(0,e),t.substring(e,t.length)]},S=f(r,2)[1];3===S.length?S+="F":6===S.length&&(S+="FF");var O=void 0;if(4===S.length){var j=f(_(S,3).map(function(t){return t+t}),2);S=j[0],O=j[1]}else if(8===S.length){var x=f(_(S,6),2);S=x[0],O=x[1]}return O=parseInt(O,16)/255,{values:[].concat(v(C(S)),[O]),type:a};case"hsla":var E=f(i(r),6),P=E[2],B=E[3],L=E[4],R=E[5],H=void 0===R?1:R;if(P>360||B>100||L>100||H<0||H>1)break;return{values:[].concat(v(A(P,B,L)),[H]),type:a};case"hsva":var D=f(i(r),6),M=D[2],F=D[3],T=D[4],N=D[5],V=void 0===N?1:N;if(M>360||F>100||T>100||V<0||V>1)break;return{values:[M,F,T,V],type:a}}return{values:null,type:null}}function O(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,o=Math.ceil,i={h:t,s:e,v:n,a:r,toHSVA:function(){var t=[i.h,i.s,i.v],e=t.map(o);return t.push(i.a),t.toString=function(){return"hsva(".concat(e[0],", ").concat(e[1],"%, ").concat(e[2],"%, ").concat(i.a.toFixed(1),")")},t},toHSLA:function(){var t=function(t,e,n){var r=(2-(e/=100))*(n/=100)/2;return 0!==r&&(e=1===r?0:r<.5?e*n/(2*r):e*n/(2-2*r)),[t,100*e,100*r]}(i.h,i.s,i.v),e=t.map(o);return t.push(i.a),t.toString=function(){return"hsla(".concat(e[0],", ").concat(e[1],"%, ").concat(e[2],"%, ").concat(i.a.toFixed(1),")")},t},toRGBA:function(){var t=_(i.h,i.s,i.v),e=t.map(o);return t.push(i.a),t.toString=function(){return"rgba(".concat(e[0],", ").concat(e[1],", ").concat(e[2],", ").concat(i.a.toFixed(1),")")},t},toCMYK:function(){var t=function(t,e,n){var r,o=_(t,e,n),i=o[0]/255,a=o[1]/255,c=o[2]/255;return[100*(1===(r=y(1-i,1-a,1-c))?0:(1-i-r)/(1-r)),100*(1===r?0:(1-a-r)/(1-r)),100*(1===r?0:(1-c-r)/(1-r)),100*r]}(i.h,i.s,i.v),e=t.map(o);return t.toString=function(){return"cmyk(".concat(e[0],"%, ").concat(e[1],"%, ").concat(e[2],"%, ").concat(e[3],"%)")},t},toHEXA:function(){var t=function(t,e,n){return _(t,e,n).map(function(t){return b(t).toString(16).padStart(2,"0")})}(i.h,i.s,i.v);return t.toString=function(){var e=i.a>=1?"":Number((255*i.a).toFixed(0)).toString(16).toUpperCase().padStart(2,"0");return"#".concat(t.join("").toUpperCase()+e)},t},clone:function(){return O(i.h,i.s,i.v,i.a)}};return i}var j=function(t){return Math.max(Math.min(t,1),0)};function x(t){var e={options:Object.assign({lock:null,onchange:function(){return 0}},t),_tapstart:function(t){a(document,["mouseup","touchend","touchcancel"],e._tapstop),a(document,["mousemove","touchmove"],e._tapmove),t.preventDefault(),e._tapmove(t)},_tapmove:function(t){var r=e.options.lock,o=e.cache,i=n.element,a=n.wrapper,c=a.getBoundingClientRect(),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=j(l/a.offsetWidth),h=j(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 E(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e0&&void 0!==arguments[0]?arguments[0]:{};t=Object.assign({onchange:function(){return 0},className:"",elements:[]},t);var e=a(t.elements,"click",function(e){t.elements.forEach(function(n){return n.classList[e.target===n?"add":"remove"](t.className)}),t.onchange(e)});return{destroy:function(){return c.apply(r,E(e))}}}function B(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=[],r=!0,o=!1,i=void 0;try{for(var a,c=t[Symbol.iterator]();!(r=(a=c.next()).done)&&(n.push(a.value),!e||n.length!==e);r=!0);}catch(t){o=!0,i=t}finally{try{r||null==c.return||c.return()}finally{if(o)throw i}}return n}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function L(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e0&&void 0!==arguments[0]?arguments[0]:{};return function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t[e];if(n)return n;var r=B(e.split("-"),2),o=r[0],i=r[1],a=void 0===i?"middle":i,c="top"===o||"bottom"===o;return t[e]={position:o,variant:a,isVertical:c}}}(),{update:function(t){var e=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=R(e,2);n=o[0],r=o[1]}else n=r=e;var i={v:"h",h:"v"};return[i[n],i[r]]}(),r=R(n,2),o=r[0],i=r[1],a={palette:x({element:t._root.palette.picker,wrapper:t._root.palette.palette,onchange:function(n,r){if(e.palette){var o=t._color,i=t._root,a=t.options;t._recalc&&(t._updateOutput(),o.s=100*n,o.v=100-100*r,o.v<0&&(o.v=0));var c=o.toRGBA().toString();this.element.style.background=c,this.wrapper.style.background="\n linear-gradient(to top, rgba(0, 0, 0, ".concat(o.a,"), transparent),\n linear-gradient(to left, hsla(").concat(o.h,", 100%, 50%, ").concat(o.a,"), rgba(255, 255, 255, ").concat(o.a,"))\n "),a.comparison||(i.button.style.color=c,a.useAsButton||(i.preview.lastColor.style.color=c)),i.preview.currentColor.style.color=c,t.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:P({elements:t._root.interaction.options,className:"active",onchange:function(e){t._representation=e.target.getAttribute("data-type").toUpperCase(),t._updateOutput()}})};this._components=a}},{key:"_bindEvents",value:function(){var t=this,e=this._root,n=this.options,r=[a(e.interaction.clear,"click",function(){return t._clearColor()}),a([e.interaction.cancel,e.preview.lastColor],"click",function(){return t.setHSVA.apply(t,L(t._lastColor.toHSVA()))}),a(e.interaction.save,"click",function(){!t.applyColor()&&!n.showAlways&&t.hide()}),a(e.interaction.result,["keyup","input"],function(e){t._recalc=!1,t.setColor(e.target.value,!0)&&!t._initializingActive&&t._emit("change",t._color),e.stopImmediatePropagation()}),a([e.palette.palette,e.palette.picker,e.hue.slider,e.hue.picker,e.opacity.slider,e.opacity.picker],["mousedown","touchstart"],function(){return t._recalc=!0})];if(!n.showAlways){var o=n.closeWithKey;r.push(a(e.button,"click",function(){return t.isOpen()?t.hide():t.show()}),a(document,"keyup",function(e){return t.isOpen()&&(e.key===o||e.code===o)&&t.hide()}),a(document,["touchstart","mousedown"],function(n){t.isOpen()&&!h(n).some(function(t){return t===e.app||t===e.button})&&t.hide()},{capture:!0}))}if(n.adjustableNumbers){var i={rgba:[255,255,255,1],hsva:[360,100,100,1],hsla:[360,100,100,1],cmyk:[100,100,100,100]};d(e.interaction.result,function(e,n,r){var o=i[t.getColorRepresentation().toLowerCase()];if(o){var a=o[r],c=e+(a>=100?1e3*n:n);return c<=0?0:Number((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,L(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,L(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=O(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(),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,L(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}}])&&H(e.prototype,n),o&&H(e,o),t}();M.utils=r,M.create=function(t){return new M(t)},M.version="1.0.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 e1ddef91..b505cbf1 100644 --- a/dist/pickr.es5.min.js.map +++ b/dist/pickr.es5.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap","webpack:///./src/js/utils/utils.js","webpack:///./src/js/utils/color.js","webpack:///./src/js/utils/hsvacolor.js","webpack:///./src/js/libs/moveable.js","webpack:///./src/js/libs/selectable.js","webpack:///./src/js/pickr.js","webpack:///./src/js/libs/nanopop.js","webpack:///./src/js/template.js"],"names":["root","factory","exports","module","define","amd","window","installedModules","__webpack_require__","moduleId","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","on","eventListener","off","method","elements","events","fn","options","arguments","length","undefined","HTMLCollection","NodeList","Array","from","isArray","_iteratorNormalCompletion","_didIteratorError","_iteratorError","_step","_iterator","iterator","next","done","el","_iteratorNormalCompletion2","_didIteratorError2","_iteratorError2","_step2","_iterator2","ev","_objectSpread","capture","err","return","slice","createElementFromString","html","div","document","createElement","innerHTML","trim","firstElementChild","removeAttribute","getAttribute","createFromTemplate","str","resolve","element","base","con","subtree","_i","_Array$from","children","child","arr","push","eventPath","evt","path","composedPath","target","parentElement","adjustableInputNumbers","mapper","v","handleScroll","e","inc","Number","shiftKey","ctrlKey","deltaY","index","selectionStart","replace","focus","setSelectionRange","preventDefault","dispatchEvent","Event","passive","min","Math","max","floor","round","hsvToRgb","h","f","q","mod","rgbToHsv","g","b","minVal","maxVal","delta","dr","dg","db","cmykToHsv","y","k","_toConsumableArray","hslToHsv","hexToHsv","hex","apply","match","map","parseInt","parseToHSV","ctx","getContext","fillStyle","regex","cmyk","rgba","hsla","hsva","numarize","array","test","type","exec","_numarize2","_slicedToArray","values","concat","_numarize4","_numarize4$","a","splitAt","substring","alpha","_splitAt$map2","_splitAt2","_numarize6","_numarize6$","_numarize8","_numarize8$","HSVaColor","ceil","that","toHSVA","rhsva","toString","toFixed","toHSLA","hsvToHsl","rhsla","toRGBA","rrgba","toCMYK","rgb","hsvToCmyk","rcmyk","toHEXA","padStart","hsvToHex","toUpperCase","join","clone","clamp","Moveable","opt","assign","lock","onchange","_tapstart","_","_tapstop","_tapmove","cache","wrapper","getBoundingClientRect","x","touch","touches","clientX","clientY","left","width","top","height","style","offsetWidth","offsetHeight","cx","cy","trigger","update","_that$options$wrapper","destroy","Selectable","className","onTap","forEach","classList","selectable_toConsumableArray","Pickr","_this","this","_classCallCheck","pickr_defineProperty","swatchselect","change","save","init","appClass","theme","useAsButton","disabled","comparison","closeOnScroll","components","interaction","strings","swatches","inline","sliders","default","defaultRepresentation","position","adjustableNumbers","showAlways","closeWithKey","_opt","includes","_ref","reference","_ref$padding","padding","vBehaviour","hBehaviour","getInfo","preview","opacity","hue","palette","_preBuild","_buildComponents","_bindEvents","_finalBuild","color","addSwatch","_nanopop","_root","button","app","start","middle","end","right","bottom","pos","cached","_pos$split2","nanopop_slicedToArray","split","_pos$split2$","variant","isVertical","_getInfo","rb","eb","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","Color","_swatchColors","hsvaColorObject","swatchColor","_this$_root","_this5","_this6","_this$_root2","recalc","_this$_components","string","_Color$parseToHSV2","utype","startsWith","click","utils","version"],"mappings":";CAAA,SAAAA,EAAAC,GACA,iBAAAC,SAAA,iBAAAC,OACAA,OAAAD,QAAAD,IACA,mBAAAG,eAAAC,IACAD,OAAA,GAAAH,GACA,iBAAAC,QACAA,QAAA,MAAAD,IAEAD,EAAA,MAAAC,IARA,CASCK,OAAA,WACD,mBCTA,IAAAC,EAAA,GAGA,SAAAC,EAAAC,GAGA,GAAAF,EAAAE,GACA,OAAAF,EAAAE,GAAAP,QAGA,IAAAC,EAAAI,EAAAE,GAAA,CACAC,EAAAD,EACAE,GAAA,EACAT,QAAA,IAUA,OANAU,EAAAH,GAAAI,KAAAV,EAAAD,QAAAC,IAAAD,QAAAM,GAGAL,EAAAQ,GAAA,EAGAR,EAAAD,QA0DA,OArDAM,EAAAM,EAAAF,EAGAJ,EAAAO,EAAAR,EAGAC,EAAAQ,EAAA,SAAAd,EAAAe,EAAAC,GACAV,EAAAW,EAAAjB,EAAAe,IACAG,OAAAC,eAAAnB,EAAAe,EAAA,CAA0CK,YAAA,EAAAC,IAAAL,KAK1CV,EAAAgB,EAAA,SAAAtB,GACA,oBA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ory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"Pickr\"] = factory();\n\telse\n\t\troot[\"Pickr\"] = factory();\n})(window, function() {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n","/**\r\n * Add event(s) to element(s).\r\n * @param elements DOM-Elements\r\n * @param events Event names\r\n * @param fn Callback\r\n * @param options Optional options\r\n * @return Array passed arguments\r\n */\r\nexport const on = eventListener.bind(null, 'addEventListener');\r\n\r\n/**\r\n * Remove event(s) from element(s).\r\n * @param elements DOM-Elements\r\n * @param events Event names\r\n * @param fn Callback\r\n * @param options Optional options\r\n * @return Array passed arguments\r\n */\r\nexport const off = eventListener.bind(null, 'removeEventListener');\r\n\r\nfunction eventListener(method, elements, events, fn, options = {}) {\r\n\r\n // Normalize array\r\n if (elements instanceof HTMLCollection || elements instanceof NodeList) {\r\n elements = Array.from(elements);\r\n } else if (!Array.isArray(elements)) {\r\n elements = [elements];\r\n }\r\n\r\n if (!Array.isArray(events)) {\r\n events = [events];\r\n }\r\n\r\n for (const el of elements) {\r\n for (const ev of events) {\r\n el[method](ev, fn, {capture: false, ...options});\r\n }\r\n }\r\n\r\n return Array.prototype.slice.call(arguments, 1);\r\n}\r\n\r\n/**\r\n * Creates an DOM-Element out of a string (Single element).\r\n * @param html HTML representing a single element\r\n * @returns {Element | null} The element.\r\n */\r\nexport function createElementFromString(html) {\r\n const div = document.createElement('div');\r\n div.innerHTML = html.trim();\r\n return div.firstElementChild;\r\n}\r\n\r\n/**\r\n * Removes an attribute from a HTMLElement and returns the value.\r\n * @param el\r\n * @param name\r\n * @return {string}\r\n */\r\nexport function removeAttribute(el, name) {\r\n const value = el.getAttribute(name);\r\n el.removeAttribute(name);\r\n return value;\r\n}\r\n\r\n/**\r\n * Creates a new html element, every element which has\r\n * a 'data-key' attribute will be saved in a object (which will be returned)\r\n * where the value of 'data-key' ist the object-key and the value the HTMLElement.\r\n *\r\n * It's possible to create a hierarchy if you add a 'data-con' attribute. Every\r\n * sibling will be added to the object which will get the name from the 'data-con' attribute.\r\n *\r\n * If you want to create an Array out of multiple elements, you can use the 'data-arr' attribute,\r\n * the value defines the key and all elements, which has the same parent and the same 'data-arr' attribute,\r\n * would be added to it.\r\n *\r\n * @param str - The HTML String.\r\n */\r\nexport function createFromTemplate(str) {\r\n\r\n // Recursive function to resolve template\r\n function resolve(element, base = {}) {\r\n\r\n // Check key and container attribute\r\n const con = removeAttribute(element, 'data-con');\r\n const key = removeAttribute(element, 'data-key');\r\n\r\n // Check and save element\r\n if (key) {\r\n base[key] = element;\r\n }\r\n\r\n // Check all children\r\n const subtree = con ? (base[con] = {}) : base;\r\n for (let child of Array.from(element.children)) {\r\n\r\n // Check if element should be saved as array\r\n const arr = removeAttribute(child, 'data-arr');\r\n if (arr) {\r\n\r\n // Check if there is already an array and add element\r\n (subtree[arr] || (subtree[arr] = [])).push(child);\r\n } else {\r\n resolve(child, subtree);\r\n }\r\n }\r\n\r\n return base;\r\n }\r\n\r\n return resolve(createElementFromString(str));\r\n}\r\n\r\n/**\r\n * Polyfill for safari & firefox for the eventPath event property.\r\n * @param evt The event object.\r\n * @return [String] event path.\r\n */\r\nexport function eventPath(evt) {\r\n let path = evt.path || (evt.composedPath && evt.composedPath());\r\n if (path) return path;\r\n\r\n let el = evt.target.parentElement;\r\n path = [evt.target, el];\r\n while (el = el.parentElement) path.push(el);\r\n\r\n path.push(document, window);\r\n return path;\r\n}\r\n\r\n/**\r\n * Creates the ability to change numbers in an input field with the scroll-wheel.\r\n * @param el\r\n * @param mapper\r\n */\r\nexport function adjustableInputNumbers(el, mapper = v => v) {\r\n\r\n function handleScroll(e) {\r\n const inc = ([0.001, 0.01, 0.1])[Number(e.shiftKey || e.ctrlKey * 2)] * (e.deltaY < 0 ? 1 : -1);\r\n\r\n let index = 0;\r\n let off = el.selectionStart;\r\n el.value = el.value.replace(/[\\d.]+/g, (v, i) => {\r\n\r\n // Check if number is in cursor range and increase it\r\n if (i <= off && i + v.length >= off) {\r\n off = i;\r\n return mapper(Number(v), inc, index);\r\n }\r\n\r\n index++;\r\n return v;\r\n });\r\n\r\n el.focus();\r\n el.setSelectionRange(off, off);\r\n\r\n // Prevent default and trigger input event\r\n e.preventDefault();\r\n el.dispatchEvent(new Event('input'));\r\n }\r\n\r\n // Bind events\r\n on(el, 'focus', () => on(window, 'wheel', handleScroll, {passive: false}));\r\n on(el, 'blur', () => off(window, 'wheel', handleScroll));\r\n}\r\n","// Shorthands\r\nconst {min, max, floor, round} = Math;\r\n\r\n/**\r\n * Tries to convert a color name to rgb/a hex representation\r\n * @param name\r\n * @returns {string | CanvasGradient | CanvasPattern}\r\n */\r\nfunction standardizeColor(name) {\r\n const ctx = document.createElement('canvas').getContext('2d');\r\n ctx.fillStyle = name;\r\n return ctx.fillStyle;\r\n}\r\n\r\n/**\r\n * Convert HSV spectrum to RGB.\r\n * @param h Hue\r\n * @param s Saturation\r\n * @param v Value\r\n * @returns {number[]} Array with rgb values.\r\n */\r\nexport function hsvToRgb(h, s, v) {\r\n h = (h / 360) * 6;\r\n s /= 100;\r\n v /= 100;\r\n\r\n let i = floor(h);\r\n\r\n let f = h - i;\r\n let p = v * (1 - s);\r\n let q = v * (1 - f * s);\r\n let t = v * (1 - (1 - f) * s);\r\n\r\n let mod = i % 6;\r\n let r = [v, q, p, p, t, v][mod];\r\n let g = [t, v, v, q, p, p][mod];\r\n let b = [p, p, t, v, v, q][mod];\r\n\r\n return [\r\n r * 255,\r\n g * 255,\r\n b * 255\r\n ];\r\n}\r\n\r\n/**\r\n * Convert HSV spectrum to Hex.\r\n * @param h Hue\r\n * @param s Saturation\r\n * @param v Value\r\n * @returns {string[]} Hex values\r\n */\r\nexport function hsvToHex(h, s, v) {\r\n return hsvToRgb(h, s, v).map(v =>\r\n round(v).toString(16).padStart(2, '0')\r\n );\r\n}\r\n\r\n/**\r\n * Convert HSV spectrum to CMYK.\r\n * @param h Hue\r\n * @param s Saturation\r\n * @param v Value\r\n * @returns {number[]} CMYK values\r\n */\r\nexport function hsvToCmyk(h, s, v) {\r\n const rgb = hsvToRgb(h, s, v);\r\n const r = rgb[0] / 255;\r\n const g = rgb[1] / 255;\r\n const b = rgb[2] / 255;\r\n\r\n let k, c, m, y;\r\n\r\n k = min(1 - r, 1 - g, 1 - b);\r\n\r\n c = k === 1 ? 0 : (1 - r - k) / (1 - k);\r\n m = k === 1 ? 0 : (1 - g - k) / (1 - k);\r\n y = k === 1 ? 0 : (1 - b - k) / (1 - k);\r\n\r\n return [\r\n c * 100,\r\n m * 100,\r\n y * 100,\r\n k * 100\r\n ];\r\n}\r\n\r\n/**\r\n * Convert HSV spectrum to HSL.\r\n * @param h Hue\r\n * @param s Saturation\r\n * @param v Value\r\n * @returns {number[]} HSL values\r\n */\r\nexport function hsvToHsl(h, s, v) {\r\n s /= 100, v /= 100;\r\n\r\n let l = (2 - s) * v / 2;\r\n\r\n if (l !== 0) {\r\n if (l === 1) {\r\n s = 0;\r\n } else if (l < 0.5) {\r\n s = s * v / (l * 2);\r\n } else {\r\n s = s * v / (2 - l * 2);\r\n }\r\n }\r\n\r\n return [\r\n h,\r\n s * 100,\r\n l * 100\r\n ];\r\n}\r\n\r\n/**\r\n * Convert RGB to HSV.\r\n * @param r Red\r\n * @param g Green\r\n * @param b Blue\r\n * @return {number[]} HSV values.\r\n */\r\nfunction rgbToHsv(r, g, b) {\r\n r /= 255, g /= 255, b /= 255;\r\n\r\n let h, s, v;\r\n const minVal = min(r, g, b);\r\n const maxVal = max(r, g, b);\r\n const delta = maxVal - minVal;\r\n\r\n v = maxVal;\r\n if (delta === 0) {\r\n h = s = 0;\r\n } else {\r\n s = delta / maxVal;\r\n let dr = (((maxVal - r) / 6) + (delta / 2)) / delta;\r\n let dg = (((maxVal - g) / 6) + (delta / 2)) / delta;\r\n let db = (((maxVal - b) / 6) + (delta / 2)) / delta;\r\n\r\n if (r === maxVal) {\r\n h = db - dg;\r\n } else if (g === maxVal) {\r\n h = (1 / 3) + dr - db;\r\n } else if (b === maxVal) {\r\n h = (2 / 3) + dg - dr;\r\n }\r\n\r\n if (h < 0) {\r\n h += 1;\r\n } else if (h > 1) {\r\n h -= 1;\r\n }\r\n }\r\n\r\n return [\r\n h * 360,\r\n s * 100,\r\n v * 100\r\n ];\r\n}\r\n\r\n/**\r\n * Convert CMYK to HSV.\r\n * @param c Cyan\r\n * @param m Magenta\r\n * @param y Yellow\r\n * @param k Key (Black)\r\n * @return {number[]} HSV values.\r\n */\r\nfunction cmykToHsv(c, m, y, k) {\r\n c /= 100, m /= 100, y /= 100, k /= 100;\r\n\r\n const r = (1 - min(1, c * (1 - k) + k)) * 255;\r\n const g = (1 - min(1, m * (1 - k) + k)) * 255;\r\n const b = (1 - min(1, y * (1 - k) + k)) * 255;\r\n\r\n return [...rgbToHsv(r, g, b)];\r\n}\r\n\r\n/**\r\n * Convert HSL to HSV.\r\n * @param h Hue\r\n * @param s Saturation\r\n * @param l Lightness\r\n * @return {number[]} HSV values.\r\n */\r\nfunction hslToHsv(h, s, l) {\r\n s /= 100, l /= 100;\r\n s *= l < 0.5 ? l : 1 - l;\r\n\r\n let ns = (2 * s / (l + s)) * 100;\r\n let v = (l + s) * 100;\r\n return [h, ns, v];\r\n}\r\n\r\n/**\r\n * Convert HEX to HSV.\r\n * @param hex Hexadecimal string of rgb colors, can have length 3 or 6.\r\n * @return {number[]} HSV values.\r\n */\r\nfunction hexToHsv(hex) {\r\n return rgbToHsv(...hex.match(/.{2}/g).map(v => parseInt(v, 16)));\r\n}\r\n\r\n/**\r\n * Try's to parse a string which represents a color to a HSV array.\r\n * Current supported types are cmyk, rgba, hsla and hexadecimal.\r\n * @param str\r\n * @return {*}\r\n */\r\nexport function parseToHSV(str) {\r\n\r\n // Check if string is a color-name\r\n str = str.match(/^[a-zA-Z]+$/) ? standardizeColor(str) : str;\r\n\r\n // Regular expressions to match different types of color represention\r\n const regex = {\r\n cmyk: /^cmyk[\\D]+(\\d+)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]+(\\d+)/i,\r\n rgba: /^(rgb|rgba)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]*?([\\d.]+|$)/i,\r\n hsla: /^(hsl|hsla)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]*?([\\d.]+|$)/i,\r\n hsva: /^(hsv|hsva)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]*?([\\d.]+|$)/i,\r\n hex: /^#?(([\\dA-Fa-f]{3,4})|([\\dA-Fa-f]{6})|([\\dA-Fa-f]{8}))$/i\r\n };\r\n\r\n /**\r\n * Takes an Array of any type, convert strings which represents\r\n * a number to a number an anything else to undefined.\r\n * @param array\r\n * @return {*}\r\n */\r\n const numarize = array => array.map(v => /^(|\\d+)\\.\\d+|\\d+$/.test(v) ? Number(v) : undefined);\r\n\r\n let match;\r\n for (const type in regex) {\r\n\r\n // Check if current scheme passed\r\n if (!(match = regex[type].exec(str)))\r\n continue;\r\n\r\n // Try to convert\r\n switch (type) {\r\n case 'cmyk': {\r\n let [, c, m, y, k] = numarize(match);\r\n\r\n if (c > 100 || m > 100 || y > 100 || k > 100)\r\n break;\r\n\r\n return {values: [...cmykToHsv(c, m, y, k), 1], type};\r\n }\r\n case 'rgba': {\r\n let [, , r, g, b, a = 1] = numarize(match);\r\n\r\n if (r > 255 || g > 255 || b > 255 || a < 0 || a > 1)\r\n break;\r\n\r\n return {values: [...rgbToHsv(r, g, b), a], type};\r\n }\r\n case 'hex': {\r\n const splitAt = (s, i) => [s.substring(0, i), s.substring(i, s.length)];\r\n let [, hex] = match;\r\n\r\n // Fill up opacity if not declared\r\n if (hex.length === 3) {\r\n hex += 'F';\r\n } else if (hex.length === 6) {\r\n hex += 'FF';\r\n }\r\n\r\n let alpha;\r\n if (hex.length === 4) {\r\n [hex, alpha] = splitAt(hex, 3).map(v => v + v);\r\n } else if (hex.length === 8) {\r\n [hex, alpha] = splitAt(hex, 6);\r\n }\r\n\r\n // Convert 0 - 255 to 0 - 1 for opacity\r\n alpha = parseInt(alpha, 16) / 255;\r\n return {values: [...hexToHsv(hex), alpha], type};\r\n }\r\n case 'hsla': {\r\n let [, , h, s, l, a = 1] = numarize(match);\r\n\r\n if (h > 360 || s > 100 || l > 100 || a < 0 || a > 1)\r\n break;\r\n\r\n return {values: [...hslToHsv(h, s, l), a], type};\r\n }\r\n case 'hsva': {\r\n let [, , h, s, v, a = 1] = numarize(match);\r\n\r\n if (h > 360 || s > 100 || v > 100 || a < 0 || a > 1)\r\n break;\r\n\r\n return {values: [h, s, v, a], type};\r\n }\r\n }\r\n }\r\n\r\n return {values: null, type: null};\r\n}\r\n","import {hsvToHsl, hsvToRgb, hsvToCmyk, hsvToHex} from './color';\r\n\r\n/**\r\n * Simple class which holds the properties\r\n * of the color represention model hsla (hue saturation lightness alpha)\r\n */\r\nexport function HSVaColor(h = 0, s = 0, v = 0, a = 1) {\r\n const {ceil} = Math;\r\n\r\n const that = {\r\n h, s, v, a,\r\n\r\n toHSVA() {\r\n const hsva = [that.h, that.s, that.v];\r\n const rhsva = hsva.map(ceil);\r\n\r\n hsva.push(that.a);\r\n hsva.toString = () => `hsva(${rhsva[0]}, ${rhsva[1]}%, ${rhsva[2]}%, ${that.a.toFixed(1)})`;\r\n return hsva;\r\n },\r\n\r\n toHSLA() {\r\n const hsla = hsvToHsl(that.h, that.s, that.v);\r\n const rhsla = hsla.map(ceil);\r\n\r\n hsla.push(that.a);\r\n hsla.toString = () => `hsla(${rhsla[0]}, ${rhsla[1]}%, ${rhsla[2]}%, ${that.a.toFixed(1)})`;\r\n return hsla;\r\n },\r\n\r\n toRGBA() {\r\n const rgba = hsvToRgb(that.h, that.s, that.v);\r\n const rrgba = rgba.map(ceil);\r\n\r\n rgba.push(that.a);\r\n rgba.toString = () => `rgba(${rrgba[0]}, ${rrgba[1]}, ${rrgba[2]}, ${that.a.toFixed(1)})`;\r\n return rgba;\r\n },\r\n\r\n toCMYK() {\r\n const cmyk = hsvToCmyk(that.h, that.s, that.v);\r\n const rcmyk = cmyk.map(ceil);\r\n\r\n cmyk.toString = () => `cmyk(${rcmyk[0]}%, ${rcmyk[1]}%, ${rcmyk[2]}%, ${rcmyk[3]}%)`;\r\n return cmyk;\r\n },\r\n\r\n toHEXA() {\r\n const hex = hsvToHex(that.h, that.s, that.v);\r\n\r\n hex.toString = () => {\r\n\r\n // Check if alpha channel make sense, convert it to 255 number space, convert\r\n // to hex and pad it with zeros if needet.\r\n const alpha = that.a >= 1 ? '' : Number((that.a * 255).toFixed(0))\r\n .toString(16)\r\n .toUpperCase().padStart(2, '0');\r\n\r\n return `#${hex.join('').toUpperCase() + alpha}`;\r\n };\r\n\r\n return hex;\r\n },\r\n\r\n clone() {\r\n return HSVaColor(that.h, that.s, that.v, that.a);\r\n }\r\n };\r\n\r\n return that;\r\n}\r\n","import * as _ from '../utils/utils';\r\n\r\nconst clamp = v => Math.max(Math.min(v, 1), 0);\r\nexport default function Moveable(opt) {\r\n\r\n const that = {\r\n\r\n // Assign default values\r\n options: Object.assign({\r\n lock: null,\r\n onchange: () => 0\r\n }, opt),\r\n\r\n _tapstart(evt) {\r\n _.on(document, ['mouseup', 'touchend', 'touchcancel'], that._tapstop);\r\n _.on(document, ['mousemove', 'touchmove'], that._tapmove);\r\n\r\n // Prevent default touch event\r\n evt.preventDefault();\r\n\r\n // Trigger\r\n that._tapmove(evt);\r\n },\r\n\r\n _tapmove(evt) {\r\n const {options: {lock}, cache} = that;\r\n const {element, wrapper} = options;\r\n const b = wrapper.getBoundingClientRect();\r\n\r\n let x = 0, y = 0;\r\n if (evt) {\r\n const touch = evt && evt.touches && evt.touches[0];\r\n x = evt ? (touch || evt).clientX : 0;\r\n y = evt ? (touch || evt).clientY : 0;\r\n\r\n // Reset to bounds\r\n if (x < b.left) x = b.left;\r\n else if (x > b.left + b.width) x = b.left + b.width;\r\n if (y < b.top) y = b.top;\r\n else if (y > b.top + b.height) y = b.top + b.height;\r\n\r\n // Normalize\r\n x -= b.left;\r\n y -= b.top;\r\n } else if (cache) {\r\n x = cache.x * b.width;\r\n y = cache.y * b.height;\r\n }\r\n\r\n if (lock !== 'h') {\r\n element.style.left = `calc(${x / b.width * 100}% - ${element.offsetWidth / 2}px)`;\r\n }\r\n\r\n if (lock !== 'v') {\r\n element.style.top = `calc(${y / b.height * 100}% - ${element.offsetHeight / 2}px)`;\r\n }\r\n\r\n that.cache = {x: x / b.width, y: y / b.height};\r\n const cx = clamp(x / wrapper.offsetWidth);\r\n const cy = clamp(y / wrapper.offsetHeight);\r\n\r\n switch (lock) {\r\n case 'v':\r\n return options.onchange(cx);\r\n case 'h':\r\n return options.onchange(cy);\r\n default:\r\n return options.onchange(cx, cy);\r\n }\r\n },\r\n\r\n _tapstop() {\r\n _.off(document, ['mouseup', 'touchend', 'touchcancel'], that._tapstop);\r\n _.off(document, ['mousemove', 'touchmove'], that._tapmove);\r\n },\r\n\r\n trigger() {\r\n that._tapmove();\r\n },\r\n\r\n update(x = 0, y = 0) {\r\n const {left, top, width, height} = that.options.wrapper.getBoundingClientRect();\r\n\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 * as Color from './utils/color';\n\n// Import classes\nimport {HSVaColor} from './utils/hsvacolor';\nimport Moveable from './libs/moveable';\nimport Selectable from './libs/selectable';\nimport Nanopop from './libs/nanopop';\nimport buildPickr from './template';\n\nclass Pickr {\n\n // Will be used to prevent specific actions during initilization\n _initializingActive = true;\n\n // 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 inst._updateOutput();\n\n // Calculate saturation based on the position\n _color.s = x * 100;\n\n // Calculate the value\n _color.v = 100 - y * 100;\n\n // Prevent falling under zero\n _color.v < 0 ? _color.v = 0 : 0;\n }\n\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} = Color.parseToHSV(color);\n\n if (values) {\n const {_swatchColors, _root} = this;\n const hsvaColorObject = HSVaColor(...values);\n\n // Create new swatch HTMLElement\n const element = _.createElementFromString(\n `'}\n\n
\n
\n
\n \n
\n
\n\n
\n
\n
\n
\n\n
\n
\n
\n
\n\n
\n
\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","test","type","exec","_numarize2","_slicedToArray","values","concat","_numarize4","_numarize4$","a","splitAt","substring","alpha","_splitAt$map2","_splitAt2","_numarize6","_numarize6$","_numarize8","_numarize8$","HSVaColor","ceil","that","toHSVA","rhsva","toString","toFixed","toHSLA","hsvToHsl","rhsla","toRGBA","rrgba","toCMYK","rgb","hsvToCmyk","rcmyk","toHEXA","padStart","hsvToHex","toUpperCase","join","clone","clamp","Moveable","opt","assign","lock","onchange","_tapstart","_","_tapstop","_tapmove","cache","wrapper","getBoundingClientRect","x","touch","touches","clientX","clientY","left","width","top","height","style","offsetWidth","offsetHeight","cx","cy","trigger","update","_that$options$wrapper","destroy","Selectable","className","onTap","forEach","classList","selectable_toConsumableArray","Pickr","_this","this","_classCallCheck","pickr_defineProperty","swatchselect","change","save","init","appClass","theme","useAsButton","disabled","comparison","closeOnScroll","components","interaction","strings","swatches","inline","sliders","default","defaultRepresentation","position","adjustableNumbers","showAlways","closeWithKey","_opt","includes","_ref","reference","_ref$padding","padding","vBehaviour","hBehaviour","getInfo","preview","opacity","hue","palette","_preBuild","_buildComponents","_bindEvents","_finalBuild","color","addSwatch","_nanopop","_root","button","app","start","middle","end","right","bottom","pos","cached","_pos$split2","nanopop_slicedToArray","split","_pos$split2$","variant","isVertical","_getInfo","rb","eb","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","Color","_swatchColors","hsvaColorObject","swatchColor","_this$_root","_this5","_this6","_this$_root2","recalc","_this$_components","string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A,MAAAC,IAM9B,OAAO2L,KAAK2I,QAAL1O,MAAA+F,KAAA4I,EAAgBvN,GAAhBC,OAAA,CAAwB2O,KAGnC,OAAO,iDASYhP,GAMnB,OAHAA,EAAOA,EAAKqC,gBAGH0C,KAAK6C,MAAM/B,YAAYpN,QAC3B6S,KAAK,SAAAjP,GAAC,OAAIA,EAAEtB,aAAa,aAAayV,WAAWxQ,KAAU3D,EAAEoU,2DAQlE,OAAO1L,KAAKsF,mDAOZ,OAAOtF,KAAK6H,yCAOZ,OAAO7H,KAAK6C,wCAUZ,OAHA7C,KAAKoH,OACLpH,KAAKtM,QAAQgN,UAAW,EACxBV,KAAK6C,MAAMC,OAAOlD,UAAU4G,IAAI,YACzBxG,sCASP,OAFAA,KAAKtM,QAAQgN,UAAW,EACxBV,KAAK6C,MAAMC,OAAOlD,UAAUuI,OAAO,YAC5BnI,0CAKfF,EAAM6L,MAAQ3N,EAGd8B,EAAMrN,OAAS,SAAAiB,GAAO,OAAI,IAAIoM,EAAMpM,IAGpCoM,EAAM8L,QAAU,QACD9L","file":"pickr.es5.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"Pickr\"] = factory();\n\telse\n\t\troot[\"Pickr\"] = factory();\n})(window, function() {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n","/**\r\n * Add event(s) to element(s).\r\n * @param elements DOM-Elements\r\n * @param events Event names\r\n * @param fn Callback\r\n * @param options Optional options\r\n * @return Array passed arguments\r\n */\r\nexport const on = eventListener.bind(null, 'addEventListener');\r\n\r\n/**\r\n * Remove event(s) from element(s).\r\n * @param elements DOM-Elements\r\n * @param events Event names\r\n * @param fn Callback\r\n * @param options Optional options\r\n * @return Array passed arguments\r\n */\r\nexport const off = eventListener.bind(null, 'removeEventListener');\r\n\r\nfunction eventListener(method, elements, events, fn, options = {}) {\r\n\r\n // Normalize array\r\n if (elements instanceof HTMLCollection || elements instanceof NodeList) {\r\n elements = Array.from(elements);\r\n } else if (!Array.isArray(elements)) {\r\n elements = [elements];\r\n }\r\n\r\n if (!Array.isArray(events)) {\r\n events = [events];\r\n }\r\n\r\n for (const el of elements) {\r\n for (const ev of events) {\r\n el[method](ev, fn, {capture: false, ...options});\r\n }\r\n }\r\n\r\n return Array.prototype.slice.call(arguments, 1);\r\n}\r\n\r\n/**\r\n * Creates an DOM-Element out of a string (Single element).\r\n * @param html HTML representing a single element\r\n * @returns {Element | null} The element.\r\n */\r\nexport function createElementFromString(html) {\r\n const div = document.createElement('div');\r\n div.innerHTML = html.trim();\r\n return div.firstElementChild;\r\n}\r\n\r\n/**\r\n * Removes an attribute from a HTMLElement and returns the value.\r\n * @param el\r\n * @param name\r\n * @return {string}\r\n */\r\nexport function removeAttribute(el, name) {\r\n const value = el.getAttribute(name);\r\n el.removeAttribute(name);\r\n return value;\r\n}\r\n\r\n/**\r\n * Creates a new html element, every element which has\r\n * a 'data-key' attribute will be saved in a object (which will be returned)\r\n * where the value of 'data-key' ist the object-key and the value the HTMLElement.\r\n *\r\n * It's possible to create a hierarchy if you add a 'data-con' attribute. Every\r\n * sibling will be added to the object which will get the name from the 'data-con' attribute.\r\n *\r\n * If you want to create an Array out of multiple elements, you can use the 'data-arr' attribute,\r\n * the value defines the key and all elements, which has the same parent and the same 'data-arr' attribute,\r\n * would be added to it.\r\n *\r\n * @param str - The HTML String.\r\n */\r\nexport function createFromTemplate(str) {\r\n\r\n // Recursive function to resolve template\r\n function resolve(element, base = {}) {\r\n\r\n // Check key and container attribute\r\n const con = removeAttribute(element, 'data-con');\r\n const key = removeAttribute(element, 'data-key');\r\n\r\n // Check and save element\r\n if (key) {\r\n base[key] = element;\r\n }\r\n\r\n // Check all children\r\n const subtree = con ? (base[con] = {}) : base;\r\n for (let child of Array.from(element.children)) {\r\n\r\n // Check if element should be saved as array\r\n const arr = removeAttribute(child, 'data-arr');\r\n if (arr) {\r\n\r\n // Check if there is already an array and add element\r\n (subtree[arr] || (subtree[arr] = [])).push(child);\r\n } else {\r\n resolve(child, subtree);\r\n }\r\n }\r\n\r\n return base;\r\n }\r\n\r\n return resolve(createElementFromString(str));\r\n}\r\n\r\n/**\r\n * Polyfill for safari & firefox for the eventPath event property.\r\n * @param evt The event object.\r\n * @return [String] event path.\r\n */\r\nexport function eventPath(evt) {\r\n let path = evt.path || (evt.composedPath && evt.composedPath());\r\n if (path) return path;\r\n\r\n let el = evt.target.parentElement;\r\n path = [evt.target, el];\r\n while (el = el.parentElement) path.push(el);\r\n\r\n path.push(document, window);\r\n return path;\r\n}\r\n\r\n/**\r\n * Creates the ability to change numbers in an input field with the scroll-wheel.\r\n * @param el\r\n * @param mapper\r\n */\r\nexport function adjustableInputNumbers(el, mapper = v => v) {\r\n\r\n function handleScroll(e) {\r\n const inc = ([0.001, 0.01, 0.1])[Number(e.shiftKey || e.ctrlKey * 2)] * (e.deltaY < 0 ? 1 : -1);\r\n\r\n let index = 0;\r\n let off = el.selectionStart;\r\n el.value = el.value.replace(/[\\d.]+/g, (v, i) => {\r\n\r\n // Check if number is in cursor range and increase it\r\n if (i <= off && i + v.length >= off) {\r\n off = i;\r\n return mapper(Number(v), inc, index);\r\n }\r\n\r\n index++;\r\n return v;\r\n });\r\n\r\n el.focus();\r\n el.setSelectionRange(off, off);\r\n\r\n // Prevent default and trigger input event\r\n e.preventDefault();\r\n el.dispatchEvent(new Event('input'));\r\n }\r\n\r\n // Bind events\r\n on(el, 'focus', () => on(window, 'wheel', handleScroll, {passive: false}));\r\n on(el, 'blur', () => off(window, 'wheel', handleScroll));\r\n}\r\n","// Shorthands\r\nconst {min, max, floor, round} = Math;\r\n\r\n/**\r\n * Tries to convert a color name to rgb/a hex representation\r\n * @param name\r\n * @returns {string | CanvasGradient | CanvasPattern}\r\n */\r\nfunction standardizeColor(name) {\r\n const ctx = document.createElement('canvas').getContext('2d');\r\n ctx.fillStyle = name;\r\n return ctx.fillStyle;\r\n}\r\n\r\n/**\r\n * Convert HSV spectrum to RGB.\r\n * @param h Hue\r\n * @param s Saturation\r\n * @param v Value\r\n * @returns {number[]} Array with rgb values.\r\n */\r\nexport function hsvToRgb(h, s, v) {\r\n h = (h / 360) * 6;\r\n s /= 100;\r\n v /= 100;\r\n\r\n let i = floor(h);\r\n\r\n let f = h - i;\r\n let p = v * (1 - s);\r\n let q = v * (1 - f * s);\r\n let t = v * (1 - (1 - f) * s);\r\n\r\n let mod = i % 6;\r\n let r = [v, q, p, p, t, v][mod];\r\n let g = [t, v, v, q, p, p][mod];\r\n let b = [p, p, t, v, v, q][mod];\r\n\r\n return [\r\n r * 255,\r\n g * 255,\r\n b * 255\r\n ];\r\n}\r\n\r\n/**\r\n * Convert HSV spectrum to Hex.\r\n * @param h Hue\r\n * @param s Saturation\r\n * @param v Value\r\n * @returns {string[]} Hex values\r\n */\r\nexport function hsvToHex(h, s, v) {\r\n return hsvToRgb(h, s, v).map(v =>\r\n round(v).toString(16).padStart(2, '0')\r\n );\r\n}\r\n\r\n/**\r\n * Convert HSV spectrum to CMYK.\r\n * @param h Hue\r\n * @param s Saturation\r\n * @param v Value\r\n * @returns {number[]} CMYK values\r\n */\r\nexport function hsvToCmyk(h, s, v) {\r\n const rgb = hsvToRgb(h, s, v);\r\n const r = rgb[0] / 255;\r\n const g = rgb[1] / 255;\r\n const b = rgb[2] / 255;\r\n\r\n let k, c, m, y;\r\n\r\n k = min(1 - r, 1 - g, 1 - b);\r\n\r\n c = k === 1 ? 0 : (1 - r - k) / (1 - k);\r\n m = k === 1 ? 0 : (1 - g - k) / (1 - k);\r\n y = k === 1 ? 0 : (1 - b - k) / (1 - k);\r\n\r\n return [\r\n c * 100,\r\n m * 100,\r\n y * 100,\r\n k * 100\r\n ];\r\n}\r\n\r\n/**\r\n * Convert HSV spectrum to HSL.\r\n * @param h Hue\r\n * @param s Saturation\r\n * @param v Value\r\n * @returns {number[]} HSL values\r\n */\r\nexport function hsvToHsl(h, s, v) {\r\n s /= 100, v /= 100;\r\n\r\n let l = (2 - s) * v / 2;\r\n\r\n if (l !== 0) {\r\n if (l === 1) {\r\n s = 0;\r\n } else if (l < 0.5) {\r\n s = s * v / (l * 2);\r\n } else {\r\n s = s * v / (2 - l * 2);\r\n }\r\n }\r\n\r\n return [\r\n h,\r\n s * 100,\r\n l * 100\r\n ];\r\n}\r\n\r\n/**\r\n * Convert RGB to HSV.\r\n * @param r Red\r\n * @param g Green\r\n * @param b Blue\r\n * @return {number[]} HSV values.\r\n */\r\nfunction rgbToHsv(r, g, b) {\r\n r /= 255, g /= 255, b /= 255;\r\n\r\n let h, s, v;\r\n const minVal = min(r, g, b);\r\n const maxVal = max(r, g, b);\r\n const delta = maxVal - minVal;\r\n\r\n v = maxVal;\r\n if (delta === 0) {\r\n h = s = 0;\r\n } else {\r\n s = delta / maxVal;\r\n let dr = (((maxVal - r) / 6) + (delta / 2)) / delta;\r\n let dg = (((maxVal - g) / 6) + (delta / 2)) / delta;\r\n let db = (((maxVal - b) / 6) + (delta / 2)) / delta;\r\n\r\n if (r === maxVal) {\r\n h = db - dg;\r\n } else if (g === maxVal) {\r\n h = (1 / 3) + dr - db;\r\n } else if (b === maxVal) {\r\n h = (2 / 3) + dg - dr;\r\n }\r\n\r\n if (h < 0) {\r\n h += 1;\r\n } else if (h > 1) {\r\n h -= 1;\r\n }\r\n }\r\n\r\n return [\r\n h * 360,\r\n s * 100,\r\n v * 100\r\n ];\r\n}\r\n\r\n/**\r\n * Convert CMYK to HSV.\r\n * @param c Cyan\r\n * @param m Magenta\r\n * @param y Yellow\r\n * @param k Key (Black)\r\n * @return {number[]} HSV values.\r\n */\r\nfunction cmykToHsv(c, m, y, k) {\r\n c /= 100, m /= 100, y /= 100, k /= 100;\r\n\r\n const r = (1 - min(1, c * (1 - k) + k)) * 255;\r\n const g = (1 - min(1, m * (1 - k) + k)) * 255;\r\n const b = (1 - min(1, y * (1 - k) + k)) * 255;\r\n\r\n return [...rgbToHsv(r, g, b)];\r\n}\r\n\r\n/**\r\n * Convert HSL to HSV.\r\n * @param h Hue\r\n * @param s Saturation\r\n * @param l Lightness\r\n * @return {number[]} HSV values.\r\n */\r\nfunction hslToHsv(h, s, l) {\r\n s /= 100, l /= 100;\r\n s *= l < 0.5 ? l : 1 - l;\r\n\r\n let ns = (2 * s / (l + s)) * 100;\r\n let v = (l + s) * 100;\r\n return [h, ns, v];\r\n}\r\n\r\n/**\r\n * Convert HEX to HSV.\r\n * @param hex Hexadecimal string of rgb colors, can have length 3 or 6.\r\n * @return {number[]} HSV values.\r\n */\r\nfunction hexToHsv(hex) {\r\n return rgbToHsv(...hex.match(/.{2}/g).map(v => parseInt(v, 16)));\r\n}\r\n\r\n/**\r\n * Try's to parse a string which represents a color to a HSV array.\r\n * Current supported types are cmyk, rgba, hsla and hexadecimal.\r\n * @param str\r\n * @return {*}\r\n */\r\nexport function parseToHSV(str) {\r\n\r\n // Check if string is a color-name\r\n str = str.match(/^[a-zA-Z]+$/) ? standardizeColor(str) : str;\r\n\r\n // Regular expressions to match different types of color represention\r\n const regex = {\r\n cmyk: /^cmyk[\\D]+(\\d+)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]+(\\d+)/i,\r\n rgba: /^(rgb|rgba)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]*?([\\d.]+|$)/i,\r\n hsla: /^(hsl|hsla)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]*?([\\d.]+|$)/i,\r\n hsva: /^(hsv|hsva)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]+(\\d+)[\\D]*?([\\d.]+|$)/i,\r\n hex: /^#?(([\\dA-Fa-f]{3,4})|([\\dA-Fa-f]{6})|([\\dA-Fa-f]{8}))$/i\r\n };\r\n\r\n /**\r\n * Takes an Array of any type, convert strings which represents\r\n * a number to a number an anything else to undefined.\r\n * @param array\r\n * @return {*}\r\n */\r\n const numarize = array => array.map(v => /^(|\\d+)\\.\\d+|\\d+$/.test(v) ? Number(v) : undefined);\r\n\r\n let match;\r\n for (const type in regex) {\r\n\r\n // Check if current scheme passed\r\n if (!(match = regex[type].exec(str)))\r\n continue;\r\n\r\n // Try to convert\r\n switch (type) {\r\n case 'cmyk': {\r\n let [, c, m, y, k] = numarize(match);\r\n\r\n if (c > 100 || m > 100 || y > 100 || k > 100)\r\n break;\r\n\r\n return {values: [...cmykToHsv(c, m, y, k), 1], type};\r\n }\r\n case 'rgba': {\r\n let [, , r, g, b, a = 1] = numarize(match);\r\n\r\n if (r > 255 || g > 255 || b > 255 || a < 0 || a > 1)\r\n break;\r\n\r\n return {values: [...rgbToHsv(r, g, b), a], type};\r\n }\r\n case 'hex': {\r\n const splitAt = (s, i) => [s.substring(0, i), s.substring(i, s.length)];\r\n let [, hex] = match;\r\n\r\n // Fill up opacity if not declared\r\n if (hex.length === 3) {\r\n hex += 'F';\r\n } else if (hex.length === 6) {\r\n hex += 'FF';\r\n }\r\n\r\n let alpha;\r\n if (hex.length === 4) {\r\n [hex, alpha] = splitAt(hex, 3).map(v => v + v);\r\n } else if (hex.length === 8) {\r\n [hex, alpha] = splitAt(hex, 6);\r\n }\r\n\r\n // Convert 0 - 255 to 0 - 1 for opacity\r\n alpha = parseInt(alpha, 16) / 255;\r\n return {values: [...hexToHsv(hex), alpha], type};\r\n }\r\n case 'hsla': {\r\n let [, , h, s, l, a = 1] = numarize(match);\r\n\r\n if (h > 360 || s > 100 || l > 100 || a < 0 || a > 1)\r\n break;\r\n\r\n return {values: [...hslToHsv(h, s, l), a], type};\r\n }\r\n case 'hsva': {\r\n let [, , h, s, v, a = 1] = numarize(match);\r\n\r\n if (h > 360 || s > 100 || v > 100 || a < 0 || a > 1)\r\n break;\r\n\r\n return {values: [h, s, v, a], type};\r\n }\r\n }\r\n }\r\n\r\n return {values: null, type: null};\r\n}\r\n","import {hsvToHsl, hsvToRgb, hsvToCmyk, hsvToHex} from './color';\r\n\r\n/**\r\n * Simple class which holds the properties\r\n * of the color represention model hsla (hue saturation lightness alpha)\r\n */\r\nexport function HSVaColor(h = 0, s = 0, v = 0, a = 1) {\r\n const {ceil} = Math;\r\n\r\n const that = {\r\n h, s, v, a,\r\n\r\n toHSVA() {\r\n const hsva = [that.h, that.s, that.v];\r\n const rhsva = hsva.map(ceil);\r\n\r\n hsva.push(that.a);\r\n hsva.toString = () => `hsva(${rhsva[0]}, ${rhsva[1]}%, ${rhsva[2]}%, ${that.a.toFixed(1)})`;\r\n return hsva;\r\n },\r\n\r\n toHSLA() {\r\n const hsla = hsvToHsl(that.h, that.s, that.v);\r\n const rhsla = hsla.map(ceil);\r\n\r\n hsla.push(that.a);\r\n hsla.toString = () => `hsla(${rhsla[0]}, ${rhsla[1]}%, ${rhsla[2]}%, ${that.a.toFixed(1)})`;\r\n return hsla;\r\n },\r\n\r\n toRGBA() {\r\n const rgba = hsvToRgb(that.h, that.s, that.v);\r\n const rrgba = rgba.map(ceil);\r\n\r\n rgba.push(that.a);\r\n rgba.toString = () => `rgba(${rrgba[0]}, ${rrgba[1]}, ${rrgba[2]}, ${that.a.toFixed(1)})`;\r\n return rgba;\r\n },\r\n\r\n toCMYK() {\r\n const cmyk = hsvToCmyk(that.h, that.s, that.v);\r\n const rcmyk = cmyk.map(ceil);\r\n\r\n cmyk.toString = () => `cmyk(${rcmyk[0]}%, ${rcmyk[1]}%, ${rcmyk[2]}%, ${rcmyk[3]}%)`;\r\n return cmyk;\r\n },\r\n\r\n toHEXA() {\r\n const hex = hsvToHex(that.h, that.s, that.v);\r\n\r\n hex.toString = () => {\r\n\r\n // Check if alpha channel make sense, convert it to 255 number space, convert\r\n // to hex and pad it with zeros if needet.\r\n const alpha = that.a >= 1 ? '' : Number((that.a * 255).toFixed(0))\r\n .toString(16)\r\n .toUpperCase().padStart(2, '0');\r\n\r\n return `#${hex.join('').toUpperCase() + alpha}`;\r\n };\r\n\r\n return hex;\r\n },\r\n\r\n clone() {\r\n return HSVaColor(that.h, that.s, that.v, that.a);\r\n }\r\n };\r\n\r\n return that;\r\n}\r\n","import * as _ from '../utils/utils';\r\n\r\nconst clamp = v => Math.max(Math.min(v, 1), 0);\r\nexport default function Moveable(opt) {\r\n\r\n const that = {\r\n\r\n // Assign default values\r\n options: Object.assign({\r\n lock: null,\r\n onchange: () => 0\r\n }, opt),\r\n\r\n _tapstart(evt) {\r\n _.on(document, ['mouseup', 'touchend', 'touchcancel'], that._tapstop);\r\n _.on(document, ['mousemove', 'touchmove'], that._tapmove);\r\n\r\n // Prevent default touch event\r\n evt.preventDefault();\r\n\r\n // Trigger\r\n that._tapmove(evt);\r\n },\r\n\r\n _tapmove(evt) {\r\n const {options: {lock}, cache} = that;\r\n const {element, wrapper} = options;\r\n const b = wrapper.getBoundingClientRect();\r\n\r\n let x = 0, y = 0;\r\n if (evt) {\r\n const touch = evt && evt.touches && evt.touches[0];\r\n x = evt ? (touch || evt).clientX : 0;\r\n y = evt ? (touch || evt).clientY : 0;\r\n\r\n // Reset to bounds\r\n if (x < b.left) x = b.left;\r\n else if (x > b.left + b.width) x = b.left + b.width;\r\n if (y < b.top) y = b.top;\r\n else if (y > b.top + b.height) y = b.top + b.height;\r\n\r\n // Normalize\r\n x -= b.left;\r\n y -= b.top;\r\n } else if (cache) {\r\n x = cache.x * b.width;\r\n y = cache.y * b.height;\r\n }\r\n\r\n if (lock !== 'h') {\r\n element.style.left = `calc(${x / b.width * 100}% - ${element.offsetWidth / 2}px)`;\r\n }\r\n\r\n if (lock !== 'v') {\r\n element.style.top = `calc(${y / b.height * 100}% - ${element.offsetHeight / 2}px)`;\r\n }\r\n\r\n that.cache = {x: x / b.width, y: y / b.height};\r\n const cx = clamp(x / wrapper.offsetWidth);\r\n const cy = clamp(y / wrapper.offsetHeight);\r\n\r\n switch (lock) {\r\n case 'v':\r\n return options.onchange(cx);\r\n case 'h':\r\n return options.onchange(cy);\r\n default:\r\n return options.onchange(cx, cy);\r\n }\r\n },\r\n\r\n _tapstop() {\r\n _.off(document, ['mouseup', 'touchend', 'touchcancel'], that._tapstop);\r\n _.off(document, ['mousemove', 'touchmove'], that._tapmove);\r\n },\r\n\r\n trigger() {\r\n that._tapmove();\r\n },\r\n\r\n update(x = 0, y = 0) {\r\n const {left, top, width, height} = that.options.wrapper.getBoundingClientRect();\r\n\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 * as Color from './utils/color';\n\n// Import classes\nimport {HSVaColor} from './utils/hsvacolor';\nimport Moveable from './libs/moveable';\nimport Selectable from './libs/selectable';\nimport Nanopop from './libs/nanopop';\nimport buildPickr from './template';\n\nclass Pickr {\n\n // Will be used to prevent specific actions during initilization\n _initializingActive = true;\n\n // 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 inst._updateOutput();\n\n // Calculate saturation based on the position\n _color.s = x * 100;\n\n // Calculate the value\n _color.v = 100 - y * 100;\n\n // Prevent falling under zero\n _color.v < 0 ? _color.v = 0 : 0;\n }\n\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} = Color.parseToHSV(color);\n\n if (values) {\n const {_swatchColors, _root} = this;\n const hsvaColorObject = HSVaColor(...values);\n\n // Create new swatch HTMLElement\n const element = _.createElementFromString(\n `'}\n\n
\n
\n
\n \n
\n
\n\n
\n
\n
\n
\n\n
\n
\n
\n
\n\n
\n
\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.css b/dist/pickr.min.css index 4772b52b..5dfbbe22 100644 --- a/dist/pickr.min.css +++ b/dist/pickr.min.css @@ -1 +1 @@ -/*! Pickr 1.0.0-beta MIT | https://github.com/Simonwep/pickr */.pickr{position:relative;overflow:visible;transform:translateY(0)}.pickr *{box-sizing:border-box}.pickr .pcr-button{position:relative;height:2em;width:2em;padding:.5em;cursor:pointer;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,sans-serif;border-radius:.15em;background:url('data:image/svg+xml;utf8, ') no-repeat 50%;background-size:0;transition:all .3s}.pickr .pcr-button:before{background:url('data:image/svg+xml;utf8, ');background-size:.5em;z-index:-1;z-index:auto}.pickr .pcr-button:after,.pickr .pcr-button:before{position:absolute;content:"";top:0;left:0;width:100%;height:100%;border-radius:.15em}.pickr .pcr-button:after{transition:background .3s;background:currentColor}.pickr .pcr-button.clear{background-size:70%}.pickr .pcr-button.clear:before{opacity:0}.pickr .pcr-button.clear:focus{box-shadow:0 0 0 1px #f1f3f4,0 0 0 3px currentColor}.pickr .pcr-button.disabled{cursor:not-allowed}.pcr-app button,.pcr-app input,.pickr button,.pickr input{outline:none;border:none;-webkit-appearance:none}.pcr-app button:focus,.pcr-app input:focus,.pickr button:focus,.pickr input:focus{box-shadow:0 0 0 1px #f1f3f4,0 0 0 3px currentColor}.pcr-app[data-theme=classic]{position:absolute;display:flex;flex-direction:column;z-index:10000;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,sans-serif;box-shadow:0 .15em 1.5em 0 rgba(0,0,0,.1),0 0 1em 0 rgba(0,0,0,.03);width:28.5em;max-width:95vw;padding:.8em;border-radius:.1em;background:#fff;opacity:0;visibility:hidden;transition:opacity .3s;left:0;top:0}.pcr-app[data-theme=classic].visible{visibility:visible;opacity:1}.pcr-app[data-theme=classic] .pcr-swatches{display:flex;flex-wrap:wrap;margin-top:.75em}.pcr-app[data-theme=classic] .pcr-swatches.pcr-last{margin:0}@supports (display:grid){.pcr-app[data-theme=classic] .pcr-swatches{display:grid;align-items:center;justify-content:space-around;grid-template-columns:repeat(auto-fit,1.75em)}}.pcr-app[data-theme=classic] .pcr-swatches>button{position:relative;width:1.75em;height:1.75em;border-radius:.15em;cursor:pointer;margin:2.5px;flex-shrink:0;justify-self:center;transition:all .15s;overflow:hidden;background:transparent;z-index:1}.pcr-app[data-theme=classic] .pcr-swatches>button:before{position:absolute;content:"";top:0;left:0;width:100%;height:100%;background:url('data:image/svg+xml;utf8, ');background-size:6px;border-radius:.15em;z-index:-1}.pcr-app[data-theme=classic] .pcr-swatches>button:after{content:"";position:absolute;top:0;left:0;width:100%;height:100%;background:currentColor;border:1px solid rgba(0,0,0,.05);border-radius:.15em;box-sizing:border-box}.pcr-app[data-theme=classic] .pcr-swatches>button:hover{filter:brightness(1.05)}.pcr-app[data-theme=classic] .pcr-interaction{display:flex;flex-wrap:wrap;align-items:center;margin:0 -.2em}.pcr-app[data-theme=classic] .pcr-interaction>*{margin:0 .2em}.pcr-app[data-theme=classic] .pcr-interaction input{letter-spacing:.07em;font-size:.75em;text-align:center;cursor:pointer;color:#75797e;background:#f1f3f4;border-radius:.15em;transition:all .15s;padding:.45em .5em;margin-top:.75em}.pcr-app[data-theme=classic] .pcr-interaction input:hover{filter:brightness(.975)}.pcr-app[data-theme=classic] .pcr-interaction input:focus{box-shadow:0 0 0 1px #f1f3f4,0 0 0 3px rgba(66,133,244,.75)}.pcr-app[data-theme=classic] .pcr-interaction .pcr-result{color:#75797e;text-align:left;flex:1 1 8em;min-width:8em;transition:all .2s;border-radius:.15em;background:#f1f3f4;cursor:text}.pcr-app[data-theme=classic] .pcr-interaction .pcr-result::selection{background:#4285f4;color:#fff}.pcr-app[data-theme=classic] .pcr-interaction .pcr-type.active{color:#fff;background:#4285f4}.pcr-app[data-theme=classic] .pcr-interaction .pcr-clear,.pcr-app[data-theme=classic] .pcr-interaction .pcr-save{width:auto;color:#fff}.pcr-app[data-theme=classic] .pcr-interaction .pcr-clear:hover,.pcr-app[data-theme=classic] .pcr-interaction .pcr-save:hover{filter:brightness(.925)}.pcr-app[data-theme=classic] .pcr-interaction .pcr-save{background:#4285f4}.pcr-app[data-theme=classic] .pcr-interaction .pcr-clear{background:#f44250}.pcr-app[data-theme=classic] .pcr-interaction .pcr-clear:focus{box-shadow:0 0 0 1px #f1f3f4,0 0 0 3px rgba(244,66,80,.75)}.pcr-app[data-theme=classic] .pcr-selection{display:flex;justify-content:space-between;flex-grow:1}.pcr-app[data-theme=classic] .pcr-selection .pcr-picker{position:absolute;height:18px;width:18px;border:2px solid #fff;border-radius:100%;user-select:none}.pcr-app[data-theme=classic] .pcr-selection .pcr-color-preview{position:relative;z-index:1;width:2em;display:flex;flex-direction:column;justify-content:space-between;margin-right:.75em}.pcr-app[data-theme=classic] .pcr-selection .pcr-color-preview:before{position:absolute;content:"";top:0;left:0;width:100%;height:100%;background:url('data:image/svg+xml;utf8, ');background-size:.5em;border-radius:.15em;z-index:-1}.pcr-app[data-theme=classic] .pcr-selection .pcr-color-preview .pcr-last-color{cursor:pointer;transition:background-color .3s,box-shadow .3s;border-radius:.15em .15em 0 0;z-index:2}.pcr-app[data-theme=classic] .pcr-selection .pcr-color-preview .pcr-current-color{border-radius:0 0 .15em .15em}.pcr-app[data-theme=classic] .pcr-selection .pcr-color-preview .pcr-current-color,.pcr-app[data-theme=classic] .pcr-selection .pcr-color-preview .pcr-last-color{background:currentColor;width:100%;height:50%}.pcr-app[data-theme=classic] .pcr-selection .pcr-color-chooser,.pcr-app[data-theme=classic] .pcr-selection .pcr-color-opacity,.pcr-app[data-theme=classic] .pcr-selection .pcr-color-palette{position:relative;user-select:none;display:flex;flex-direction:column;cursor:grab;cursor:-moz-grab;cursor:-webkit-grab}.pcr-app[data-theme=classic] .pcr-selection .pcr-color-chooser:active,.pcr-app[data-theme=classic] .pcr-selection .pcr-color-opacity:active,.pcr-app[data-theme=classic] .pcr-selection .pcr-color-palette:active{cursor:grabbing;cursor:-moz-grabbing;cursor:-webkit-grabbing}.pcr-app[data-theme=classic] .pcr-selection .pcr-color-palette{width:100%;height:8em;z-index:1}.pcr-app[data-theme=classic] .pcr-selection .pcr-color-palette .pcr-palette{flex-grow:1;border-radius:.15em}.pcr-app[data-theme=classic] .pcr-selection .pcr-color-palette .pcr-palette:before{position:absolute;content:"";top:0;left:0;width:100%;height:100%;background:url('data:image/svg+xml;utf8, ');background-size:.5em;border-radius:.15em;z-index:-1}.pcr-app[data-theme=classic] .pcr-selection .pcr-color-chooser,.pcr-app[data-theme=classic] .pcr-selection .pcr-color-opacity{margin-left:.75em}.pcr-app[data-theme=classic] .pcr-selection .pcr-color-chooser .pcr-picker,.pcr-app[data-theme=classic] .pcr-selection .pcr-color-opacity .pcr-picker{left:50%;transform:translateX(-50%)}.pcr-app[data-theme=classic] .pcr-selection .pcr-color-chooser .pcr-slider,.pcr-app[data-theme=classic] .pcr-selection .pcr-color-opacity .pcr-slider{width:8px;flex-grow:1;border-radius:50em}.pcr-app[data-theme=classic] .pcr-selection .pcr-color-chooser .pcr-slider{background:linear-gradient(180deg,red,#ff0,#0f0,#0ff,#00f,#f0f,red)}.pcr-app[data-theme=classic] .pcr-selection .pcr-color-opacity .pcr-slider{background:linear-gradient(180deg,transparent,#000),url('data:image/svg+xml;utf8, ');background-size:100%,50%} \ No newline at end of file +/*! Pickr 1.0.0 MIT | https://github.com/Simonwep/pickr */.pickr{position:relative;overflow:visible;transform:translateY(0)}.pickr *{box-sizing:border-box}.pickr .pcr-button{position:relative;height:2em;width:2em;padding:.5em;cursor:pointer;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,sans-serif;border-radius:.15em;background:url('data:image/svg+xml;utf8, ') no-repeat 50%;background-size:0;transition:all .3s}.pickr .pcr-button:before{background:url('data:image/svg+xml;utf8, ');background-size:.5em;z-index:-1;z-index:auto}.pickr .pcr-button:after,.pickr .pcr-button:before{position:absolute;content:"";top:0;left:0;width:100%;height:100%;border-radius:.15em}.pickr .pcr-button:after{transition:background .3s;background:currentColor}.pickr .pcr-button.clear{background-size:70%}.pickr .pcr-button.clear:before{opacity:0}.pickr .pcr-button.clear:focus{box-shadow:0 0 0 1px #f1f3f4,0 0 0 3px currentColor}.pickr .pcr-button.disabled{cursor:not-allowed}.pcr-app button,.pcr-app input,.pickr button,.pickr input{outline:none;border:none;-webkit-appearance:none}.pcr-app button:focus,.pcr-app input:focus,.pickr button:focus,.pickr input:focus{box-shadow:0 0 0 1px #f1f3f4,0 0 0 3px currentColor}.pcr-app[data-theme=classic]{position:absolute;display:flex;flex-direction:column;z-index:10000;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,sans-serif;box-shadow:0 .15em 1.5em 0 rgba(0,0,0,.1),0 0 1em 0 rgba(0,0,0,.03);width:28.5em;max-width:95vw;padding:.8em;border-radius:.1em;background:#fff;opacity:0;visibility:hidden;transition:opacity .3s;left:0;top:0}.pcr-app[data-theme=classic].visible{visibility:visible;opacity:1}.pcr-app[data-theme=classic] .pcr-swatches{display:flex;flex-wrap:wrap;margin-top:.75em}.pcr-app[data-theme=classic] .pcr-swatches.pcr-last{margin:0}@supports (display:grid){.pcr-app[data-theme=classic] .pcr-swatches{display:grid;align-items:center;justify-content:space-around;grid-template-columns:repeat(auto-fit,1.75em)}}.pcr-app[data-theme=classic] .pcr-swatches>button{position:relative;width:1.75em;height:1.75em;border-radius:.15em;cursor:pointer;margin:2.5px;flex-shrink:0;justify-self:center;transition:all .15s;overflow:hidden;background:transparent;z-index:1}.pcr-app[data-theme=classic] .pcr-swatches>button:before{position:absolute;content:"";top:0;left:0;width:100%;height:100%;background:url('data:image/svg+xml;utf8, ');background-size:6px;border-radius:.15em;z-index:-1}.pcr-app[data-theme=classic] .pcr-swatches>button:after{content:"";position:absolute;top:0;left:0;width:100%;height:100%;background:currentColor;border:1px solid rgba(0,0,0,.05);border-radius:.15em;box-sizing:border-box}.pcr-app[data-theme=classic] .pcr-swatches>button:hover{filter:brightness(1.05)}.pcr-app[data-theme=classic] .pcr-interaction{display:flex;flex-wrap:wrap;align-items:center;margin:0 -.2em}.pcr-app[data-theme=classic] .pcr-interaction>*{margin:0 .2em}.pcr-app[data-theme=classic] .pcr-interaction input{letter-spacing:.07em;font-size:.75em;text-align:center;cursor:pointer;color:#75797e;background:#f1f3f4;border-radius:.15em;transition:all .15s;padding:.45em .5em;margin-top:.75em}.pcr-app[data-theme=classic] .pcr-interaction input:hover{filter:brightness(.975)}.pcr-app[data-theme=classic] .pcr-interaction input:focus{box-shadow:0 0 0 1px #f1f3f4,0 0 0 3px rgba(66,133,244,.75)}.pcr-app[data-theme=classic] .pcr-interaction .pcr-result{color:#75797e;text-align:left;flex:1 1 8em;min-width:8em;transition:all .2s;border-radius:.15em;background:#f1f3f4;cursor:text}.pcr-app[data-theme=classic] .pcr-interaction .pcr-result::selection{background:#4285f4;color:#fff}.pcr-app[data-theme=classic] .pcr-interaction .pcr-type.active{color:#fff;background:#4285f4}.pcr-app[data-theme=classic] .pcr-interaction .pcr-clear,.pcr-app[data-theme=classic] .pcr-interaction .pcr-save{width:auto;color:#fff}.pcr-app[data-theme=classic] .pcr-interaction .pcr-clear:hover,.pcr-app[data-theme=classic] .pcr-interaction .pcr-save:hover{filter:brightness(.925)}.pcr-app[data-theme=classic] .pcr-interaction .pcr-save{background:#4285f4}.pcr-app[data-theme=classic] .pcr-interaction .pcr-clear{background:#f44250}.pcr-app[data-theme=classic] .pcr-interaction .pcr-clear:focus{box-shadow:0 0 0 1px #f1f3f4,0 0 0 3px rgba(244,66,80,.75)}.pcr-app[data-theme=classic] .pcr-selection{display:flex;justify-content:space-between;flex-grow:1}.pcr-app[data-theme=classic] .pcr-selection .pcr-picker{position:absolute;height:18px;width:18px;border:2px solid #fff;border-radius:100%;user-select:none}.pcr-app[data-theme=classic] .pcr-selection .pcr-color-preview{position:relative;z-index:1;width:2em;display:flex;flex-direction:column;justify-content:space-between;margin-right:.75em}.pcr-app[data-theme=classic] .pcr-selection .pcr-color-preview:before{position:absolute;content:"";top:0;left:0;width:100%;height:100%;background:url('data:image/svg+xml;utf8, ');background-size:.5em;border-radius:.15em;z-index:-1}.pcr-app[data-theme=classic] .pcr-selection .pcr-color-preview .pcr-last-color{cursor:pointer;transition:background-color .3s,box-shadow .3s;border-radius:.15em .15em 0 0;z-index:2}.pcr-app[data-theme=classic] .pcr-selection .pcr-color-preview .pcr-current-color{border-radius:0 0 .15em .15em}.pcr-app[data-theme=classic] .pcr-selection .pcr-color-preview .pcr-current-color,.pcr-app[data-theme=classic] .pcr-selection .pcr-color-preview .pcr-last-color{background:currentColor;width:100%;height:50%}.pcr-app[data-theme=classic] .pcr-selection .pcr-color-chooser,.pcr-app[data-theme=classic] .pcr-selection .pcr-color-opacity,.pcr-app[data-theme=classic] .pcr-selection .pcr-color-palette{position:relative;user-select:none;display:flex;flex-direction:column;cursor:grab;cursor:-moz-grab;cursor:-webkit-grab}.pcr-app[data-theme=classic] .pcr-selection .pcr-color-chooser:active,.pcr-app[data-theme=classic] .pcr-selection .pcr-color-opacity:active,.pcr-app[data-theme=classic] .pcr-selection .pcr-color-palette:active{cursor:grabbing;cursor:-moz-grabbing;cursor:-webkit-grabbing}.pcr-app[data-theme=classic] .pcr-selection .pcr-color-palette{width:100%;height:8em;z-index:1}.pcr-app[data-theme=classic] .pcr-selection .pcr-color-palette .pcr-palette{flex-grow:1;border-radius:.15em}.pcr-app[data-theme=classic] .pcr-selection .pcr-color-palette .pcr-palette:before{position:absolute;content:"";top:0;left:0;width:100%;height:100%;background:url('data:image/svg+xml;utf8, ');background-size:.5em;border-radius:.15em;z-index:-1}.pcr-app[data-theme=classic] .pcr-selection .pcr-color-chooser,.pcr-app[data-theme=classic] .pcr-selection .pcr-color-opacity{margin-left:.75em}.pcr-app[data-theme=classic] .pcr-selection .pcr-color-chooser .pcr-picker,.pcr-app[data-theme=classic] .pcr-selection .pcr-color-opacity .pcr-picker{left:50%;transform:translateX(-50%)}.pcr-app[data-theme=classic] .pcr-selection .pcr-color-chooser .pcr-slider,.pcr-app[data-theme=classic] .pcr-selection .pcr-color-opacity .pcr-slider{width:8px;flex-grow:1;border-radius:50em}.pcr-app[data-theme=classic] .pcr-selection .pcr-color-chooser .pcr-slider{background:linear-gradient(180deg,red,#ff0,#0f0,#0ff,#00f,#f0f,red)}.pcr-app[data-theme=classic] .pcr-selection .pcr-color-opacity .pcr-slider{background:linear-gradient(180deg,transparent,#000),url('data:image/svg+xml;utf8, ');background-size:100%,50%} \ No newline at end of file diff --git a/dist/pickr.min.js b/dist/pickr.min.js index 90d650ff..5423dc8c 100644 --- a/dist/pickr.min.js +++ b/dist/pickr.min.js @@ -1,3 +1,3 @@ -/*! Pickr 1.0.0-beta 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,i,r;const s=f(t/=255,e/=255,n/=255),a=m(t,e,n),c=a-s;if(0===c)o=i=0;else{i=c/a;let r=((a-t)/6+c/2)/c,s=((a-e)/6+c/2)/c,l=((a-n)/6+c/2)/c;t===a?o=l-s:e===a?o=1/3+r-l:n===a&&(o=2/3+s-r),o<0?o+=1:o>1&&(o-=1)}return[360*o,100*i,100*(r=a)]}function _(t,e,n,o){return e/=100,n/=100,[...g(255*(1-f(1,(t/=100)*(1-(o/=100))+o)),255*(1-f(1,e*(1-o)+o)),255*(1-f(1,n*(1-o)+o)))]}function w(t,e,n){return e/=100,[t,2*(e*=(n/=100)<.5?n:1-n)/(n+e)*100,100*(n+e)]}function k(t){return g(...t.match(/.{2}/g).map(t=>parseInt(t,16)))}function A(t){t=t.match(/^[a-zA-Z]+$/)?function(t){const e=document.createElement("canvas").getContext("2d");return e.fillStyle=t,e.fillStyle}(t):t;const e={cmyk:/^cmyk[\D]+(\d+)[\D]+(\d+)[\D]+(\d+)[\D]+(\d+)/i,rgba:/^(rgb|rgba)[\D]+(\d+)[\D]+(\d+)[\D]+(\d+)[\D]*?([\d.]+|$)/i,hsla:/^(hsl|hsla)[\D]+(\d+)[\D]+(\d+)[\D]+(\d+)[\D]*?([\d.]+|$)/i,hsva:/^(hsv|hsva)[\D]+(\d+)[\D]+(\d+)[\D]+(\d+)[\D]*?([\d.]+|$)/i,hex:/^#?(([\dA-Fa-f]{3,4})|([\dA-Fa-f]{6})|([\dA-Fa-f]{8}))$/i},n=t=>t.map(t=>/^(|\d+)\.\d+|\d+$/.test(t)?Number(t):void 0);let o;for(const i in e)if(o=e[i].exec(t))switch(i){case"cmyk":{let[,t,e,r,s]=n(o);if(t>100||e>100||r>100||s>100)break;return{values:[..._(t,e,r,s),1],type:i}}case"rgba":{let[,,t,e,r,s=1]=n(o);if(t>255||e>255||r>255||s<0||s>1)break;return{values:[...g(t,e,r),s],type:i}}case"hex":{const t=(t,e)=>[t.substring(0,e),t.substring(e,t.length)];let e,[,n]=o;return 3===n.length?n+="F":6===n.length&&(n+="FF"),4===n.length?[n,e]=t(n,3).map(t=>t+t):8===n.length&&([n,e]=t(n,6)),e=parseInt(e,16)/255,{values:[...k(n),e],type:i}}case"hsla":{let[,,t,e,r,s=1]=n(o);if(t>360||e>100||r>100||s<0||s>1)break;return{values:[...w(t,e,r),s],type:i}}case"hsva":{let[,,t,e,r,s=1]=n(o);if(t>360||e>100||r>100||s<0||s>1)break;return{values:[t,e,r,s],type:i}}}return{values:null,type:null}}function C(t=0,e=0,n=0,o=1){const{ceil:i}=Math,r={h:t,s:e,v:n,a:o,toHSVA(){const t=[r.h,r.s,r.v],e=t.map(i);return t.push(r.a),t.toString=()=>"hsva(".concat(e[0],", ").concat(e[1],"%, ").concat(e[2],"%, ").concat(r.a.toFixed(1),")"),t},toHSLA(){const t=function(t,e,n){let o=(2-(e/=100))*(n/=100)/2;return 0!==o&&(e=1===o?0:o<.5?e*n/(2*o):e*n/(2-2*o)),[t,100*e,100*o]}(r.h,r.s,r.v),e=t.map(i);return t.push(r.a),t.toString=()=>"hsla(".concat(e[0],", ").concat(e[1],"%, ").concat(e[2],"%, ").concat(r.a.toFixed(1),")"),t},toRGBA(){const t=b(r.h,r.s,r.v),e=t.map(i);return t.push(r.a),t.toString=()=>"rgba(".concat(e[0],", ").concat(e[1],", ").concat(e[2],", ").concat(r.a.toFixed(1),")"),t},toCMYK(){const t=function(t,e,n){const o=b(t,e,n),i=o[0]/255,r=o[1]/255,s=o[2]/255;let a,c,l,p;return[100*(c=1===(a=f(1-i,1-r,1-s))?0:(1-i-a)/(1-a)),100*(l=1===a?0:(1-r-a)/(1-a)),100*(p=1===a?0:(1-s-a)/(1-a)),100*a]}(r.h,r.s,r.v),e=t.map(i);return t.toString=()=>"cmyk(".concat(e[0],"%, ").concat(e[1],"%, ").concat(e[2],"%, ").concat(e[3],"%)"),t},toHEXA(){const t=function(t,e,n){return b(t,e,n).map(t=>y(t).toString(16).padStart(2,"0"))}(r.h,r.s,r.v);return t.toString=()=>{const e=r.a>=1?"":Number((255*r.a).toFixed(0)).toString(16).toUpperCase().padStart(2,"0");return"#".concat(t.join("").toUpperCase()+e)},t},clone:()=>C(r.h,r.s,r.v,r.a)};return r}const S=t=>Math.max(Math.min(t,1),0);function O(t){const e={options:Object.assign({lock:null,onchange:()=>0},t),_tapstart(t){s(document,["mouseup","touchend","touchcancel"],e._tapstop),s(document,["mousemove","touchmove"],e._tapmove),t.preventDefault(),e._tapmove(t)},_tapmove(t){const{options:{lock:o},cache:i}=e,{element:r,wrapper:s}=n,a=s.getBoundingClientRect();let c=0,l=0;if(t){const e=t&&t.touches&&t.touches[0];c=t?(e||t).clientX:0,l=t?(e||t).clientY:0,ca.left+a.width&&(c=a.left+a.width),la.top+a.height&&(l=a.top+a.height),c-=a.left,l-=a.top}else i&&(c=i.x*a.width,l=i.y*a.height);"h"!==o&&(r.style.left="calc(".concat(c/a.width*100,"% - ").concat(r.offsetWidth/2,"px)")),"v"!==o&&(r.style.top="calc(".concat(l/a.height*100,"% - ").concat(r.offsetHeight/2,"px)")),e.cache={x:c/a.width,y:l/a.height};const p=S(c/s.offsetWidth),u=S(l/s.offsetHeight);switch(o){case"v":return n.onchange(p);case"h":return n.onchange(u);default:return n.onchange(p,u)}},_tapstop(){a(document,["mouseup","touchend","touchcancel"],e._tapstop),a(document,["mousemove","touchmove"],e._tapmove)},trigger(){e._tapmove()},update(t=0,n=0){const{left:o,top:i,width:r,height:s}=e.options.wrapper.getBoundingClientRect();"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 j=({components:t,strings:e,useAsButton:n,inline:o,appClass:i,theme:r})=>{const s=t=>t?"":'style="display:none" hidden',a=u('\n
\n\n '.concat(n?"":'','\n\n
\n
\n
\n \n
\n
\n\n
\n
\n
\n
\n\n
\n
\n
\n
\n\n
\n
\n
\n
\n
\n\n
\n\n
\n \n\n \n \n \n \n \n\n \n \n \n
\n
\n
\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 E(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}class B{constructor(t){E(this,"_initializingActive",!0),E(this,"_recalc",!0),E(this,"_color",C()),E(this,"_lastColor",C()),E(this,"_swatchColors",[]),E(this,"_eventListener",{swatchselect:[],change:[],save:[],init:[]}),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),p=e.getBoundingClientRect(),u=t.getBoundingClientRect(),h=((t,e=0)=>{for(;t=t.parentElement;)e+=t.scrollTop;return e})(t),d=t=>t?{t:p.top-u.height-n,b:p.bottom+n+h}:{r:p.right+n,l:p.left-u.width-n},f=t=>t?{s:p.left+p.width-u.width,m:-u.width/2+(p.left+p.width/2),e:p.left}:{s:p.bottom-u.height,m:p.bottom-p.height/2-u.height/2,e:p.bottom-p.height};function m(e,n,o){const i="top"===o,r=i?u.height:u.width,s=window[i?"innerHeight":"innerWidth"];for(const i of e){const e=n[i];if(e>0&&e+r>/g).reduce((t,e,n,o)=>(t=t.querySelector(e),n{const{sliders:e}=t.options;let n="v",o="v";e&&e.match(/^[vh]+$/g)&&(e.length>1?[n,o]=e:n=o=e);const i={v:"h",h:"v"};return[i[n],i[o]]})(),i={palette:O({element:t._root.palette.picker,wrapper:t._root.palette.palette,onchange(n,o){if(!e.palette)return;const{_color:i,_root:r,options:s}=t;t._recalc&&(t._updateOutput(),i.s=100*n,i.v=100-100*o,i.v<0&&(i.v=0));const a=i.toRGBA().toString();this.element.style.background=a,this.wrapper.style.background="\n linear-gradient(to top, rgba(0, 0, 0, ".concat(i.a,"), transparent),\n linear-gradient(to left, hsla(").concat(i.h,", 100%, 50%, ").concat(i.a,"), rgba(255, 255, 255, ").concat(i.a,"))\n "),s.comparison||(r.button.style.color=a,s.useAsButton||(r.preview.lastColor.style.color=a)),r.preview.currentColor.style.color=a,t.options.comparison||r.button.classList.remove("clear")}}),hue:O({lock:o,element:t._root.hue.picker,wrapper:t._root.hue.slider,onchange(n){e.hue&&e.palette&&(t._recalc&&(t._color.h=360*n),this.element.style.backgroundColor="hsl(".concat(t._color.h,", 100%, 50%)"),i.palette.trigger())}}),opacity:O({lock:n,element:t._root.opacity.picker,wrapper:t._root.opacity.slider,onchange(n){e.opacity&&e.palette&&(t._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}=A(t);if(e){const{_swatchColors:t,_root:n}=this,o=C(...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 E(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}class B{constructor(t){E(this,"_initializingActive",!0),E(this,"_recalc",!0),E(this,"_color",C()),E(this,"_lastColor",C()),E(this,"_swatchColors",[]),E(this,"_eventListener",{swatchselect:[],change:[],save:[],init:[]}),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),p=e.getBoundingClientRect(),u=t.getBoundingClientRect(),h=((t,e=0)=>{for(;t=t.parentElement;)e+=t.scrollTop;return e})(t),d=t=>t?{t:p.top-u.height-n,b:p.bottom+n+h}:{r:p.right+n,l:p.left-u.width-n},f=t=>t?{s:p.left+p.width-u.width,m:-u.width/2+(p.left+p.width/2),e:p.left}:{s:p.bottom-u.height,m:p.bottom-p.height/2-u.height/2,e:p.bottom-p.height};function m(e,n,o){const i="top"===o,r=i?u.height:u.width,s=window[i?"innerHeight":"innerWidth"];for(const i of e){const e=n[i];if(e>0&&e+r>/g).reduce((t,e,n,o)=>(t=t.querySelector(e),n{const{sliders:e}=t.options;let n="v",o="v";e&&e.match(/^[vh]+$/g)&&(e.length>1?[n,o]=e:n=o=e);const i={v:"h",h:"v"};return[i[n],i[o]]})(),i={palette:O({element:t._root.palette.picker,wrapper:t._root.palette.palette,onchange(n,o){if(!e.palette)return;const{_color:i,_root:r,options:s}=t;t._recalc&&(t._updateOutput(),i.s=100*n,i.v=100-100*o,i.v<0&&(i.v=0));const a=i.toRGBA().toString();this.element.style.background=a,this.wrapper.style.background="\n linear-gradient(to top, rgba(0, 0, 0, ".concat(i.a,"), transparent),\n linear-gradient(to left, hsla(").concat(i.h,", 100%, 50%, ").concat(i.a,"), rgba(255, 255, 255, ").concat(i.a,"))\n "),s.comparison||(r.button.style.color=a,s.useAsButton||(r.preview.lastColor.style.color=a)),r.preview.currentColor.style.color=a,t.options.comparison||r.button.classList.remove("clear")}}),hue:O({lock:o,element:t._root.hue.picker,wrapper:t._root.hue.slider,onchange(n){e.hue&&e.palette&&(t._recalc&&(t._color.h=360*n),this.element.style.backgroundColor="hsl(".concat(t._color.h,", 100%, 50%)"),i.palette.trigger())}}),opacity:O({lock:n,element:t._root.opacity.picker,wrapper:t._root.opacity.slider,onchange(n){e.opacity&&e.palette&&(t._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}=A(t);if(e){const{_swatchColors:t,_root:n}=this,o=C(...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 * as Color from './utils/color';\n\n// Import classes\nimport {HSVaColor} from './utils/hsvacolor';\nimport Moveable from './libs/moveable';\nimport Selectable from './libs/selectable';\nimport Nanopop from './libs/nanopop';\nimport buildPickr from './template';\n\nclass Pickr {\n\n // Will be used to prevent specific actions during initilization\n _initializingActive = true;\n\n // 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 inst._updateOutput();\n\n // Calculate saturation based on the position\n _color.s = x * 100;\n\n // Calculate the value\n _color.v = 100 - y * 100;\n\n // Prevent falling under zero\n _color.v < 0 ? _color.v = 0 : 0;\n }\n\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} = Color.parseToHSV(color);\n\n if (values) {\n const {_swatchColors, _root} = this;\n const hsvaColorObject = HSVaColor(...values);\n\n // Create new swatch HTMLElement\n const element = _.createElementFromString(\n `'}\n\n
\n
\n
\n \n
\n
\n\n
\n
\n
\n
\n\n
\n
\n
\n
\n\n
\n
\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 * as Color from './utils/color';\n\n// Import classes\nimport {HSVaColor} from './utils/hsvacolor';\nimport Moveable from './libs/moveable';\nimport Selectable from './libs/selectable';\nimport Nanopop from './libs/nanopop';\nimport buildPickr from './template';\n\nclass Pickr {\n\n // Will be used to prevent specific actions during initilization\n _initializingActive = true;\n\n // 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 inst._updateOutput();\n\n // Calculate saturation based on the position\n _color.s = x * 100;\n\n // Calculate the value\n _color.v = 100 - y * 100;\n\n // Prevent falling under zero\n _color.v < 0 ? _color.v = 0 : 0;\n }\n\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} = Color.parseToHSV(color);\n\n if (values) {\n const {_swatchColors, _root} = this;\n const hsvaColorObject = HSVaColor(...values);\n\n // Create new swatch HTMLElement\n const element = _.createElementFromString(\n `