{"version":3,"sources":["webpack://iroDynamicCss/webpack/universalModuleDefinition","webpack://iroDynamicCss/webpack/bootstrap","webpack://iroDynamicCss/./stylesheet.js","webpack://iroDynamicCss/./index.js","webpack://iroDynamicCss/./util.js"],"names":["root","factory","exports","module","define","amd","self","this","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","Stylesheet","_classCallCheck","style","document","createElement","head","appendChild","createTextNode","sheet","map","selector","rules","replace","$1","toLowerCase","setProperty","index","length","declaration","concat","insertRule","e","addRule","cssRules","disabled","keys","selectorText","ruleText","cssText","join","reduce","result","ruleSet","getPropertyValue","DynamicCssPlugin","iro","pluginOptions","throttleDelay","throttle","updateStylesheet","css","rgb","color","rgbString","properties","stylesheet","setRule","ColorPicker","addHook","callback","delay","timer","fn","props","setTimeout","IroStylesheet","dynamicCss","version","VERSION"],"mappings":";;;;;;;CAAA,SAAAA,EAAAC,GACA,iBAAAC,SAAA,iBAAAC,OACAA,OAAAD,QAAAD,IACA,mBAAAG,eAAAC,IACAD,OAAA,mBAAAH,GACA,iBAAAC,QACAA,QAAA,cAAAD,IAEAD,EAAA,cAAAC,IARA,CASC,oBAAAK,UAAAC,KAAA,WACD,mBCTA,IAAAC,EAAA,GAGA,SAAAC,EAAAC,GAGA,GAAAF,EAAAE,GACA,OAAAF,EAAAE,GAAAR,QAGA,IAAAC,EAAAK,EAAAE,GAAA,CACAC,EAAAD,EACAE,GAAA,EACAV,QAAA,IAUA,OANAW,EAAAH,GAAAI,KAAAX,EAAAD,QAAAC,IAAAD,QAAAO,GAGAN,EAAAS,GAAA,EAGAT,EAAAD,QA0DA,OArDAO,EAAAM,EAAAF,EAGAJ,EAAAO,EAAAR,EAGAC,EAAAQ,EAAA,SAAAf,EAAAgB,EAAAC,GACAV,EAAAW,EAAAlB,EAAAgB,IACAG,OAAAC,eAAApB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K8E,MAAMC,UACvB,IAAK,IAAIjC,KAAY8B,EAAK,CACxB,IAAII,EAAaJ,EAAI9B,GACrB,IAAK,IAAIf,KAAYiD,EACnBhF,KAAKiF,WAAWC,QAAQpC,EAAUf,EAAU8C,KAKlDN,EAAIY,YAAYC,QAAQ,cAAe,WClBjB,IAASC,EAAUC,EACrCC,EAEEC,EDgBJxF,KAAK4E,IAAM5E,KAAKyF,MAAMb,KAAO,GAC7B5E,KAAK2E,iBAAmBF,GCpBKY,EDoBoBV,EAAiB/C,KAAK5B,MCpBhCsF,EDoBuCb,ECnB5Ec,EAAQ,KAENC,EAAK,WACTH,IACAE,EAAQ,MAGH,WACAA,IAAOA,EAAQG,WAAWF,EAAIF,MDW4DX,EAAiB/C,KAAK5B,MACrHA,KAAKiF,WAAa,IAAIU,IAGxBpB,EAAIY,YAAYC,QAAQ,oBAAqB,WAC3CpF,KAAK2E,qBAGPJ,EAAInC,WAAauD,EAEjBpB,EAAIqB,WAAa,CACfC,QAASC","file":"iro-dynamic-css.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(\"iroDynamicCss\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"iroDynamicCss\"] = factory();\n\telse\n\t\troot[\"iroDynamicCss\"] = factory();\n})(typeof self !== 'undefined' ? self : this, 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","export default class Stylesheet {\n /**\n @constructor stylesheet writer\n */\n constructor() {\n // Create a new style element\n const style = document.createElement('style');\n document.head.appendChild(style);\n // Webkit apparently requires a text node to be inserted into the style element\n // (according to https://davidwalsh.name/add-rules-stylesheets)\n style.appendChild(document.createTextNode(''));\n this.style = style;\n // Create a reference to the style element's CSSStyleSheet object\n // CSSStyleSheet API: https://developer.mozilla.org/en-US/docs/Web/API/CSSStyleSheet\n this.sheet = style.sheet;\n // We'll store references to all the CSSStyleDeclaration objects that we change here, keyed by the CSS selector they belong to\n // CSSStyleDeclaration API: https://developer.mozilla.org/en-US/docs/Web/API/CSSStyleDeclaration\n this.map = {};\n }\n\n get rules() {\n // Get a reference to the sheet's CSSRuleList object\n // CSSRuleList API: https://developer.mozilla.org/en-US/docs/Web/API/CSSRuleList\n return this.sheet.rules || this.sheet.cssRules;\n }\n\n get enabled() {\n return !this.sheet.disabled;\n }\n\n set enabled(value) {\n this.sheet.disabled = !value;\n }\n\n /**\n * @desc Set a specific rule for a given selector\n * @param {String} selector - the CSS selector for this rule (e.g. \"body\", \".class\", \"#id\")\n * @param {String} property - the CSS property to set (e.g. \"background-color\", \"font-family\", \"z-index\")\n * @param {String} value - the new value for the rule (e.g. \"rgb(255, 255, 255)\", \"Helvetica\", \"99\")\n */\n setRule(selector, property, value) {\n const { sheet, map, rules } = this;\n // Convert property from camelCase to snake-case\n property = property.replace(/([A-Z])/g, function($1) {\n return '-' + $1.toLowerCase();\n });\n\n if (!map.hasOwnProperty(selector)) {\n // If the selector hasn't been used yet we want to insert the rule at the end of the CSSRuleList, so we use its length as the index value\n const index = rules.length;\n // Prepare the rule declaration text, since both insertRule and addRule take this format\n const declaration = `${property}: ${value}`;\n // Insert the new rule into the stylesheet\n try {\n // Some browsers only support insertRule, others only support addRule, so we have to use both\n sheet.insertRule(`${selector} {${declaration};}`, index);\n } catch(e) {\n sheet.addRule(selector, declaration, index);\n } finally {\n // Add our newly inserted rule's CSSStyleDeclaration object to the internal map\n map[selector] = this.rules[index].style;\n }\n }\n else {\n map[selector].setProperty(property, value);\n }\n }\n\n /**\n * @desc Get the stylesheet text\n * @return {String} css text\n */\n get cssText() {\n const { map } = this;\n return Object.keys(map).map(selector => {\n const selectorText = selector.replace(/,\\W/g, ',\\n');\n const ruleText = map[selector].cssText.replace(/;\\W/g, ';\\n\\t');\n return `${selectorText} {\\n\\t${ruleText}\\n}`;\n }).join('\\n');\n }\n\n /**\n * @desc Get an object representing the current css styles\n * @return {Object} css object\n */\n get css() {\n const { map } = this;\n return Object.keys(map).reduce((result, selector) => {\n const ruleSet = map[selector];\n result[selector] = {};\n for (var i = 0; i < ruleSet.length; i++) {\n const property = ruleSet[i];\n result[selector][property] = ruleSet.getPropertyValue(property);\n }\n return result;\n }, {});\n }\n}","import IroStylesheet from './stylesheet.js';\nimport { throttle } from './util.js';\n\nconst DynamicCssPlugin = function(iro, pluginOptions) {\n\n const throttleDelay = pluginOptions.throttle || null;\n\n const updateStylesheet = function() {\n const css = this.css;\n const rgb = this.color.rgbString;\n for (let selector in css) {\n let properties = css[selector];\n for (let property in properties) {\n this.stylesheet.setRule(selector, property, rgb);\n }\n }\n }\n\n iro.ColorPicker.addHook('init:before', function() {\n this.css = this.props.css || {};\n this.updateStylesheet = throttleDelay ? throttle(updateStylesheet.bind(this), throttleDelay) : updateStylesheet.bind(this);\n this.stylesheet = new IroStylesheet();\n });\n\n iro.ColorPicker.addHook('color:afterUpdate', function() {\n this.updateStylesheet();\n });\n\n iro.Stylesheet = IroStylesheet;\n\n iro.dynamicCss = {\n version: VERSION\n };\n\n}\n\nexport default DynamicCssPlugin;","export const throttle = function(callback, delay) {\n let timer = null;\n \n const fn = () => {\n callback();\n timer = null;\n }\n \n return function() {\n if (!timer) timer = setTimeout(fn, delay);\n }\n}"],"sourceRoot":""}