@justeattakeaway/pie-icons 2.0.0-beta.7 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/pie-icons.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pie-icons.js","mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;;;;;;;;;;;;;;;;ACVO,IAAMA,aAAa,GAAG;EACzBC,KAAK,EAAE;AACX,CAAC;AAEM,IAAMC,qBAAqB,GAAG;EACjCC,KAAK,EAAE,EAAE;EACTC,MAAM,EAAE,EAAE;EACVC,IAAI,EAAE;AACV,CAAC;AAED,iEAAeL,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACVe;AAE4B;AAAA,IAGjEO,IAAI;EACN,SAAAA,KAAaC,IAAI,EAAEC,QAAQ,EAAEC,KAAK,EAAEC,UAAU,EAAE;IAAAC,eAAA,OAAAL,IAAA;IAC5C,IAAI,CAACC,IAAI,GAAGA,IAAI;IAChB,IAAI,CAACC,QAAQ,GAAGA,QAAQ;IACxB,IAAI,CAACC,KAAK,GAAAG,aAAA,CAAAA,aAAA,KACHb,yDAAa,GACbU,KAAK,CACX;IACD,IAAIC,UAAU,KAAKG,SAAS,IAAIH,UAAU,KAAK,EAAE,EAAE;MAC/C,IAAI,CAACA,UAAU,GAAGA,UAAU;IAChC;EACJ;;EAEA;AACJ;AACA;AACA;AACA;AACA;EALII,YAAA,CAAAR,IAAA;IAAAS,GAAA;IAAAC,KAAA,EAMA,SAAAC,MAAA,EAAyC;MAAA,IAAlCR,KAAK,GAAAS,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAL,SAAA,GAAAK,SAAA,MAAG,CAAC,CAAC;MAAA,IAAEE,QAAQ,GAAAF,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAL,SAAA,GAAAK,SAAA,MAAG,SAAS;MACnC,IAAMG,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YAAY;AAC/B;AACA;AACA;;AAEA,iBAAiB;;AAEjB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,mBAAmB,YAAY;AAC/B;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,KAAK;AACL;;AAEA,QAAQ;AACR,KAAK;AACL;;AAEA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,mBAAmB,SAAS;AAC5B;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,EAAE;;AAEF,KAAK,KAA6B;AAClC;AACA;AACA,GAAG,SAAS,IAA4E;AACxF;AACA,EAAE,iCAAqB,EAAE,mCAAE;AAC3B;AACA,GAAG;AAAA,kGAAC;AACJ,GAAG,KAAK,EAEN;AACF,CAAC;;;;;;;;;;;;;;;;;;UCjHD;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCtBA;WACA;WACA;WACA;WACA;WACA,iCAAiC,WAAW;WAC5C;WACA;;;;;WCPA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA;;;;;WCAA;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;;;;;;;;;;;;;ACN4B;AACI;AAEhC,iEAAe;EAAEJ,KAAK,EAALA,8CAAK;EAAEI,OAAO,EAAPA,gDAAOA;AAAC,CAAC,E","sources":["webpack://pie-icons/webpack/universalModuleDefinition","webpack://pie-icons/./src/default-attrs.js","webpack://pie-icons/./src/icon.js","webpack://pie-icons/./src/icons.js","webpack://pie-icons/./src/replace.js","webpack://pie-icons/../../../node_modules/classnames/dedupe.js","webpack://pie-icons/webpack/bootstrap","webpack://pie-icons/webpack/runtime/compat get default export","webpack://pie-icons/webpack/runtime/define property getters","webpack://pie-icons/webpack/runtime/hasOwnProperty shorthand","webpack://pie-icons/webpack/runtime/make namespace object","webpack://pie-icons/./src/index.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[\"pie-icons\"] = factory();\n\telse\n\t\troot[\"pie-icons\"] = factory();\n})(typeof self !== 'undefined' ? self : this, function() {\nreturn ","export const DEFAULT_ATTRS = {\n xmlns: 'http://www.w3.org/2000/svg'\n};\n\nexport const REACTIVE_NATIVE_ATTRS = {\n width: 50,\n height: 50,\n fill: 'orange'\n};\n\nexport default DEFAULT_ATTRS;\n","import classnames from 'classnames/dedupe';\n\nimport { DEFAULT_ATTRS, REACTIVE_NATIVE_ATTRS } from './default-attrs';\n\n\nclass Icon {\n constructor (name, contents, attrs, pathPrefix) {\n this.name = name;\n this.contents = contents;\n this.attrs = {\n ...DEFAULT_ATTRS,\n ...attrs\n };\n if (pathPrefix !== undefined && pathPrefix !== '') {\n this.pathPrefix = pathPrefix;\n }\n }\n\n /**\n * Create an SVG string.\n * @param {Object} attrs\n * @param {String} platform - Identifier for platform specific attrs to be included/excluded\n * @returns {string}\n */\n toSvg (attrs = {}, platform = 'default') {\n const normalisedClassname = normaliseClassname(this.name);\n\n const classname = classnames('c-pieIcon', `c-pieIcon--${normalisedClassname}`, this.attrs.class, attrs.class);\n\n const combinedAttrs = {\n ...this.attrs,\n ...attrs,\n ...(platform === 'default' ? { class: classname } : {}), // don't include classes when not using the default attrs\n ...(platform === 'reactNative' ? REACTIVE_NATIVE_ATTRS : {})\n };\n\n return `<svg ${attrsToString(combinedAttrs)}>${this.contents}</svg>`;\n }\n}\n\n/**\n * Normalises a string into camelCase format\n * E.g. alert-circle-filled > alertCircleFilled\n *\n * @param {String} classname – the class to be normalised\n * @returns {String}\n */\nexport function normaliseClassname (classname) {\n // Split name by dashes into an array\n const splitClassname = classname.split('-');\n\n // then map these such that the first index is lowercase and the rest are Uppercased\n const camelCaseClassnames = splitClassname.map((name, index) => (\n (index === 0)\n ? name.substring(0, 1).toLowerCase() + (name).substring(1)\n : name.substring(0, 1).toUpperCase() + (name).substring(1)));\n\n return camelCaseClassnames.join('');\n}\n\n/**\n * Convert attributes object to string of HTML attributes.\n * @param {Object} attrs\n * @returns {string}\n */\nfunction attrsToString (attrs) {\n return Object.keys(attrs)\n .map(key => `${key}=\"${attrs[key]}\"`)\n .join(' ');\n}\n\nexport default Icon;\n","import Icon from './icon';\nimport icons from '../dist/icons.json'; // eslint-disable-line import/no-unresolved\n\nexport default Object.keys(icons)\n .map(key => new Icon(key, icons[key].contents, icons[key].attrs, icons[key].pathPrefix))\n .reduce((object, icon) => {\n object[icon.name] = icon;\n return object;\n }, {});\n","/* eslint-env browser */\nimport classnames from 'classnames/dedupe';\n\nimport icons from './icons';\n\n/**\n * Replace all HTML elements that have a `data-pie-icons` attribute with SVG markup\n * corresponding to the element's `data-pie-icons` attribute value.\n * @param {Object} attrs\n */\nfunction replace (attrs = {}) {\n if (typeof document === 'undefined') {\n throw new Error('`pie-icons.replace()` only works in a browser environment.');\n }\n\n const elementsToReplace = document.querySelectorAll('[data-pie-icons]');\n\n Array.from(elementsToReplace).forEach(element => replaceElement(element, attrs));\n}\n\n/**\n * Replace a single HTML element with SVG markup\n * corresponding to the element's `data-pie-icons` attribute value.\n * @param {HTMLElement} element\n * @param {Object} attrs\n */\nfunction replaceElement (element, attrs = {}) {\n const elementAttrs = getAttrs(element);\n const name = elementAttrs['data-pie-icons'];\n delete elementAttrs['data-pie-icons'];\n\n const svgString = icons[name].toSvg({\n ...attrs,\n ...elementAttrs,\n ...{ class: classnames(attrs.class, elementAttrs.class) }\n });\n const svgDocument = new DOMParser().parseFromString(\n svgString,\n 'image/svg+xml'\n );\n const svgElement = svgDocument.querySelector('svg');\n\n element.parentNode.replaceChild(svgElement, element);\n}\n\n/**\n * Get the attributes of an HTML element.\n * @param {HTMLElement} element\n * @returns {Object}\n */\nfunction getAttrs (element) {\n return Array.from(element.attributes).reduce((attrs, attr) => {\n attrs[attr.name] = attr.value;\n return attrs;\n }, {});\n}\n\nexport default replace;\n","/*!\n Copyright (c) 2018 Jed Watson.\n Licensed under the MIT License (MIT), see\n http://jedwatson.github.io/classnames\n*/\n/* global define */\n\n(function () {\n\t'use strict';\n\n\tvar classNames = (function () {\n\t\t// don't inherit from Object so we can skip hasOwnProperty check later\n\t\t// http://stackoverflow.com/questions/15518328/creating-js-object-with-object-createnull#answer-21079232\n\t\tfunction StorageObject() {}\n\t\tStorageObject.prototype = Object.create(null);\n\n\t\tfunction _parseArray (resultSet, array) {\n\t\t\tvar length = array.length;\n\n\t\t\tfor (var i = 0; i < length; ++i) {\n\t\t\t\t_parse(resultSet, array[i]);\n\t\t\t}\n\t\t}\n\n\t\tvar hasOwn = {}.hasOwnProperty;\n\n\t\tfunction _parseNumber (resultSet, num) {\n\t\t\tresultSet[num] = true;\n\t\t}\n\n\t\tfunction _parseObject (resultSet, object) {\n\t\t\tif (object.toString === Object.prototype.toString) {\n\t\t\t\tfor (var k in object) {\n\t\t\t\t\tif (hasOwn.call(object, k)) {\n\t\t\t\t\t\t// set value to false instead of deleting it to avoid changing object structure\n\t\t\t\t\t\t// https://www.smashingmagazine.com/2012/11/writing-fast-memory-efficient-javascript/#de-referencing-misconceptions\n\t\t\t\t\t\tresultSet[k] = !!object[k];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tresultSet[object.toString()] = true;\n\t\t\t}\n\t\t}\n\n\t\tvar SPACE = /\\s+/;\n\t\tfunction _parseString (resultSet, str) {\n\t\t\tvar array = str.split(SPACE);\n\t\t\tvar length = array.length;\n\n\t\t\tfor (var i = 0; i < length; ++i) {\n\t\t\t\tresultSet[array[i]] = true;\n\t\t\t}\n\t\t}\n\n\t\tfunction _parse (resultSet, arg) {\n\t\t\tif (!arg) return;\n\t\t\tvar argType = typeof arg;\n\n\t\t\t// 'foo bar'\n\t\t\tif (argType === 'string') {\n\t\t\t\t_parseString(resultSet, arg);\n\n\t\t\t// ['foo', 'bar', ...]\n\t\t\t} else if (Array.isArray(arg)) {\n\t\t\t\t_parseArray(resultSet, arg);\n\n\t\t\t// { 'foo': true, ... }\n\t\t\t} else if (argType === 'object') {\n\t\t\t\t_parseObject(resultSet, arg);\n\n\t\t\t// '130'\n\t\t\t} else if (argType === 'number') {\n\t\t\t\t_parseNumber(resultSet, arg);\n\t\t\t}\n\t\t}\n\n\t\tfunction _classNames () {\n\t\t\t// don't leak arguments\n\t\t\t// https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments\n\t\t\tvar len = arguments.length;\n\t\t\tvar args = Array(len);\n\t\t\tfor (var i = 0; i < len; i++) {\n\t\t\t\targs[i] = arguments[i];\n\t\t\t}\n\n\t\t\tvar classSet = new StorageObject();\n\t\t\t_parseArray(classSet, args);\n\n\t\t\tvar list = [];\n\n\t\t\tfor (var k in classSet) {\n\t\t\t\tif (classSet[k]) {\n\t\t\t\t\tlist.push(k)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn list.join(' ');\n\t\t}\n\n\t\treturn _classNames;\n\t})();\n\n\tif (typeof module !== 'undefined' && module.exports) {\n\t\tclassNames.default = classNames;\n\t\tmodule.exports = classNames;\n\t} else if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {\n\t\t// register as 'classnames', consistent with npm package name\n\t\tdefine('classnames', [], function () {\n\t\t\treturn classNames;\n\t\t});\n\t} else {\n\t\twindow.classNames = classNames;\n\t}\n}());\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import icons from './icons';\nimport replace from './replace';\n\nexport default { icons, replace };\n"],"names":["DEFAULT_ATTRS","xmlns","REACTIVE_NATIVE_ATTRS","width","height","fill","classnames","Icon","name","contents","attrs","pathPrefix","_classCallCheck","_objectSpread","undefined","_createClass","key","value","toSvg","arguments","length","platform","normalisedClassname","normaliseClassname","classname","concat","combinedAttrs","attrsToString","splitClassname","split","camelCaseClassnames","map","index","substring","toLowerCase","toUpperCase","join","Object","keys","icons","reduce","object","icon","replace","document","Error","elementsToReplace","querySelectorAll","Array","from","forEach","element","replaceElement","elementAttrs","getAttrs","svgString","svgDocument","DOMParser","parseFromString","svgElement","querySelector","parentNode","replaceChild","attributes","attr"],"sourceRoot":""}
|
|
1
|
+
{"version":3,"file":"pie-icons.js","mappings":"AAAA;AACA;AACA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A;AACA,KAAK;AACL;;AAEA,QAAQ;AACR,KAAK;AACL;;AAEA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,mBAAmB,SAAS;AAC5B;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,EAAE;;AAEF,KAAK,KAA6B;AAClC;AACA;AACA,GAAG,SAAS,IAA4E;AACxF;AACA,EAAE,iCAAqB,EAAE,mCAAE;AAC3B;AACA,GAAG;AAAA,kGAAC;AACJ,GAAG,KAAK,EAEN;AACF,CAAC;;;;;;;;;;;;;;;;;;UCjHD;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCtBA;WACA;WACA;WACA;WACA;WACA,iCAAiC,WAAW;WAC5C;WACA;;;;;WCPA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA;;;;;WCAA;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;;;;;;;;;;;;;ACN4B;AACI;AAEhC,iEAAe;EAAEJ,KAAK,EAALA,8CAAK;EAAEI,OAAO,EAAPA,gDAAOA;AAAC,CAAC,E","sources":["webpack://pie-icons/webpack/universalModuleDefinition","webpack://pie-icons/./src/default-attrs.js","webpack://pie-icons/./src/icon.js","webpack://pie-icons/./src/icons.js","webpack://pie-icons/./src/replace.js","webpack://pie-icons/../../../node_modules/classnames/dedupe.js","webpack://pie-icons/webpack/bootstrap","webpack://pie-icons/webpack/runtime/compat get default export","webpack://pie-icons/webpack/runtime/define property getters","webpack://pie-icons/webpack/runtime/hasOwnProperty shorthand","webpack://pie-icons/webpack/runtime/make namespace object","webpack://pie-icons/./src/index.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[\"pie-icons\"] = factory();\n\telse\n\t\troot[\"pie-icons\"] = factory();\n})(typeof self !== 'undefined' ? self : this, function() {\nreturn ","export const DEFAULT_ATTRS = {\n xmlns: 'http://www.w3.org/2000/svg',\n};\n\nexport const REACTIVE_NATIVE_ATTRS = {\n width: 50,\n height: 50,\n fill: 'orange',\n};\n\nexport default DEFAULT_ATTRS;\n","import classnames from 'classnames/dedupe';\n\nimport { DEFAULT_ATTRS, REACTIVE_NATIVE_ATTRS } from './default-attrs';\n\nclass Icon {\n constructor (name, contents, attrs, pathPrefix) {\n this.name = name;\n this.contents = contents;\n this.attrs = {\n ...DEFAULT_ATTRS,\n ...attrs,\n };\n if (pathPrefix !== undefined && pathPrefix !== '') {\n this.pathPrefix = pathPrefix;\n }\n }\n\n /**\n * Create an SVG string.\n * @param {Object} attrs\n * @param {String} platform - Identifier for platform specific attrs to be included/excluded\n * @returns {string}\n */\n toSvg (attrs = {}, platform = 'default') {\n const normalisedClassname = normaliseClassname(this.name);\n\n const classname = classnames('c-pieIcon', `c-pieIcon--${normalisedClassname}`, this.attrs.class, attrs.class);\n\n const combinedAttrs = {\n ...this.attrs,\n ...attrs,\n ...(platform === 'default' ? { class: classname } : {}), // don't include classes when not using the default attrs\n ...(platform === 'reactNative' ? REACTIVE_NATIVE_ATTRS : {}),\n };\n\n return `<svg ${attrsToString(combinedAttrs)}>${this.contents}</svg>`;\n }\n}\n\n/**\n * Normalises a string into camelCase format\n * E.g. alert-circle-filled > alertCircleFilled\n *\n * @param {String} classname – the class to be normalised\n * @returns {String}\n */\nexport function normaliseClassname (classname) {\n // Split name by dashes into an array\n const splitClassname = classname.split('-');\n\n // then map these such that the first index is lowercase and the rest are Uppercased\n const camelCaseClassnames = splitClassname.map((name, index) => (\n (index === 0)\n ? name.substring(0, 1).toLowerCase() + (name).substring(1)\n : name.substring(0, 1).toUpperCase() + (name).substring(1)));\n\n return camelCaseClassnames.join('');\n}\n\n/**\n * Convert attributes object to string of HTML attributes.\n * @param {Object} attrs\n * @returns {string}\n */\nfunction attrsToString (attrs) {\n return Object.keys(attrs)\n .map((key) => `${key}=\"${attrs[key]}\"`)\n .join(' ');\n}\n\nexport default Icon;\n","import Icon from './icon';\nimport icons from '../dist/icons.json'; // eslint-disable-line import/no-unresolved\n\nexport default Object.keys(icons)\n .map((key) => new Icon(key, icons[key].contents, icons[key].attrs, icons[key].pathPrefix))\n .reduce((object, icon) => {\n object[icon.name] = icon;\n return object;\n }, {});\n","/* eslint-env browser */\nimport classnames from 'classnames/dedupe';\n\nimport icons from './icons';\n\n/**\n * Replace all HTML elements that have a `data-pie-icons` attribute with SVG markup\n * corresponding to the element's `data-pie-icons` attribute value.\n * @param {Object} attrs\n */\nfunction replace (attrs = {}) {\n if (typeof document === 'undefined') {\n throw new Error('`pie-icons.replace()` only works in a browser environment.');\n }\n\n const elementsToReplace = document.querySelectorAll('[data-pie-icons]');\n\n Array.from(elementsToReplace).forEach((element) => replaceElement(element, attrs));\n}\n\n/**\n * Replace a single HTML element with SVG markup\n * corresponding to the element's `data-pie-icons` attribute value.\n * @param {HTMLElement} element\n * @param {Object} attrs\n */\nfunction replaceElement (element, attrs = {}) {\n const elementAttrs = getAttrs(element);\n const name = elementAttrs['data-pie-icons'];\n delete elementAttrs['data-pie-icons'];\n\n const svgString = icons[name].toSvg({\n ...attrs,\n ...elementAttrs,\n ...{ class: classnames(attrs.class, elementAttrs.class) },\n });\n const svgDocument = new DOMParser().parseFromString(\n svgString,\n 'image/svg+xml',\n );\n const svgElement = svgDocument.querySelector('svg');\n\n element.parentNode.replaceChild(svgElement, element);\n}\n\n/**\n * Get the attributes of an HTML element.\n * @param {HTMLElement} element\n * @returns {Object}\n */\nfunction getAttrs (element) {\n return Array.from(element.attributes).reduce((attrs, attr) => {\n attrs[attr.name] = attr.value;\n return attrs;\n }, {});\n}\n\nexport default replace;\n","/*!\n Copyright (c) 2018 Jed Watson.\n Licensed under the MIT License (MIT), see\n http://jedwatson.github.io/classnames\n*/\n/* global define */\n\n(function () {\n\t'use strict';\n\n\tvar classNames = (function () {\n\t\t// don't inherit from Object so we can skip hasOwnProperty check later\n\t\t// http://stackoverflow.com/questions/15518328/creating-js-object-with-object-createnull#answer-21079232\n\t\tfunction StorageObject() {}\n\t\tStorageObject.prototype = Object.create(null);\n\n\t\tfunction _parseArray (resultSet, array) {\n\t\t\tvar length = array.length;\n\n\t\t\tfor (var i = 0; i < length; ++i) {\n\t\t\t\t_parse(resultSet, array[i]);\n\t\t\t}\n\t\t}\n\n\t\tvar hasOwn = {}.hasOwnProperty;\n\n\t\tfunction _parseNumber (resultSet, num) {\n\t\t\tresultSet[num] = true;\n\t\t}\n\n\t\tfunction _parseObject (resultSet, object) {\n\t\t\tif (object.toString === Object.prototype.toString) {\n\t\t\t\tfor (var k in object) {\n\t\t\t\t\tif (hasOwn.call(object, k)) {\n\t\t\t\t\t\t// set value to false instead of deleting it to avoid changing object structure\n\t\t\t\t\t\t// https://www.smashingmagazine.com/2012/11/writing-fast-memory-efficient-javascript/#de-referencing-misconceptions\n\t\t\t\t\t\tresultSet[k] = !!object[k];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tresultSet[object.toString()] = true;\n\t\t\t}\n\t\t}\n\n\t\tvar SPACE = /\\s+/;\n\t\tfunction _parseString (resultSet, str) {\n\t\t\tvar array = str.split(SPACE);\n\t\t\tvar length = array.length;\n\n\t\t\tfor (var i = 0; i < length; ++i) {\n\t\t\t\tresultSet[array[i]] = true;\n\t\t\t}\n\t\t}\n\n\t\tfunction _parse (resultSet, arg) {\n\t\t\tif (!arg) return;\n\t\t\tvar argType = typeof arg;\n\n\t\t\t// 'foo bar'\n\t\t\tif (argType === 'string') {\n\t\t\t\t_parseString(resultSet, arg);\n\n\t\t\t// ['foo', 'bar', ...]\n\t\t\t} else if (Array.isArray(arg)) {\n\t\t\t\t_parseArray(resultSet, arg);\n\n\t\t\t// { 'foo': true, ... }\n\t\t\t} else if (argType === 'object') {\n\t\t\t\t_parseObject(resultSet, arg);\n\n\t\t\t// '130'\n\t\t\t} else if (argType === 'number') {\n\t\t\t\t_parseNumber(resultSet, arg);\n\t\t\t}\n\t\t}\n\n\t\tfunction _classNames () {\n\t\t\t// don't leak arguments\n\t\t\t// https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments\n\t\t\tvar len = arguments.length;\n\t\t\tvar args = Array(len);\n\t\t\tfor (var i = 0; i < len; i++) {\n\t\t\t\targs[i] = arguments[i];\n\t\t\t}\n\n\t\t\tvar classSet = new StorageObject();\n\t\t\t_parseArray(classSet, args);\n\n\t\t\tvar list = [];\n\n\t\t\tfor (var k in classSet) {\n\t\t\t\tif (classSet[k]) {\n\t\t\t\t\tlist.push(k)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn list.join(' ');\n\t\t}\n\n\t\treturn _classNames;\n\t})();\n\n\tif (typeof module !== 'undefined' && module.exports) {\n\t\tclassNames.default = classNames;\n\t\tmodule.exports = classNames;\n\t} else if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {\n\t\t// register as 'classnames', consistent with npm package name\n\t\tdefine('classnames', [], function () {\n\t\t\treturn classNames;\n\t\t});\n\t} else {\n\t\twindow.classNames = classNames;\n\t}\n}());\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import icons from './icons';\nimport replace from './replace';\n\nexport default { icons, replace };\n"],"names":["DEFAULT_ATTRS","xmlns","REACTIVE_NATIVE_ATTRS","width","height","fill","classnames","Icon","name","contents","attrs","pathPrefix","_classCallCheck","_objectSpread","undefined","_createClass","key","value","toSvg","arguments","length","platform","normalisedClassname","normaliseClassname","classname","concat","combinedAttrs","attrsToString","splitClassname","split","camelCaseClassnames","map","index","substring","toLowerCase","toUpperCase","join","Object","keys","icons","reduce","object","icon","replace","document","Error","elementsToReplace","querySelectorAll","Array","from","forEach","element","replaceElement","elementAttrs","getAttrs","svgString","svgDocument","DOMParser","parseFromString","svgElement","querySelector","parentNode","replaceChild","attributes","attr"],"sourceRoot":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pie-icons.min.js","mappings":";CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,GAAIH,GACe,iBAAZC,QACdA,QAAQ,aAAeD,IAEvBD,EAAK,aAAeC,GACrB,CATD,CASmB,oBAATK,KAAuBA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,MAAOmB,EAAMvC,GAAKqB,WAAW,IACtFmB,QAAO,SAACnE,EAAQoE,GAEb,OADApE,EAAOoE,EAAKvB,MAAQuB,EACbpE,CACX,GAAG,CAAC,qsCCiDN,MCtDA,GAAiBkE,MAAAA,EAAOG,QDOxB,WAA8B,IAAZtB,EAAKvC,UAAAxB,OAAA,QAAAmC,IAAAX,UAAA,GAAAA,UAAA,GAAG,CAAC,EACvB,GAAwB,oBAAb8D,SACP,MAAM,IAAIC,MAAM,8DAGpB,IAAMC,EAAoBF,SAASG,iBAAiB,oBAEpD3E,MAAM4E,KAAKF,GAAmBG,SAAQ,SAAAC,GAAO,OASjD,SAAyBA,GAAqB,IAAZ7B,EAAKvC,UAAAxB,OAAA,QAAAmC,IAAAX,UAAA,GAAAA,UAAA,GAAG,CAAC,EACjCqE,EAuBV,SAAmBD,GACf,OAAO9E,MAAM4E,KAAKE,EAAQE,YAAYX,QAAO,SAACpB,EAAOgC,GAEjD,OADAhC,EAAMgC,EAAKlC,MAAQkC,EAAK1C,MACjBU,CACX,GAAG,CAAC,EACR,CA5ByBiC,CAASJ,GACxB/B,EAAOgC,EAAa,yBACnBA,EAAa,kBAEpB,IAAMI,EAAYf,EAAMrB,GAAMqC,MAAKhC,EAAAA,EAAAA,EAAC,CAAC,EAC9BH,GACA8B,GACA,CAAEd,MAAOH,IAAWb,EAAK,MAAQ8B,EAAY,UAM9CM,GAJc,IAAIC,WAAYC,gBAChCJ,EACA,iBAE2BK,cAAc,OAE7CV,EAAQW,WAAWC,aAAaL,EAAYP,EAChD,CA1BqDa,CAAeb,EAAS7B,EAAM,GACnF","sources":["webpack://pie-icons/webpack/universalModuleDefinition","webpack://pie-icons/../../../node_modules/classnames/dedupe.js","webpack://pie-icons/webpack/bootstrap","webpack://pie-icons/webpack/runtime/compat get default export","webpack://pie-icons/webpack/runtime/define property getters","webpack://pie-icons/webpack/runtime/hasOwnProperty shorthand","webpack://pie-icons/webpack/runtime/make namespace object","webpack://pie-icons/./src/default-attrs.js","webpack://pie-icons/./src/icon.js","webpack://pie-icons/./src/icons.js","webpack://pie-icons/./src/replace.js","webpack://pie-icons/./src/index.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[\"pie-icons\"] = factory();\n\telse\n\t\troot[\"pie-icons\"] = factory();\n})(typeof self !== 'undefined' ? self : this, function() {\nreturn ","/*!\n Copyright (c) 2018 Jed Watson.\n Licensed under the MIT License (MIT), see\n http://jedwatson.github.io/classnames\n*/\n/* global define */\n\n(function () {\n\t'use strict';\n\n\tvar classNames = (function () {\n\t\t// don't inherit from Object so we can skip hasOwnProperty check later\n\t\t// http://stackoverflow.com/questions/15518328/creating-js-object-with-object-createnull#answer-21079232\n\t\tfunction StorageObject() {}\n\t\tStorageObject.prototype = Object.create(null);\n\n\t\tfunction _parseArray (resultSet, array) {\n\t\t\tvar length = array.length;\n\n\t\t\tfor (var i = 0; i < length; ++i) {\n\t\t\t\t_parse(resultSet, array[i]);\n\t\t\t}\n\t\t}\n\n\t\tvar hasOwn = {}.hasOwnProperty;\n\n\t\tfunction _parseNumber (resultSet, num) {\n\t\t\tresultSet[num] = true;\n\t\t}\n\n\t\tfunction _parseObject (resultSet, object) {\n\t\t\tif (object.toString === Object.prototype.toString) {\n\t\t\t\tfor (var k in object) {\n\t\t\t\t\tif (hasOwn.call(object, k)) {\n\t\t\t\t\t\t// set value to false instead of deleting it to avoid changing object structure\n\t\t\t\t\t\t// https://www.smashingmagazine.com/2012/11/writing-fast-memory-efficient-javascript/#de-referencing-misconceptions\n\t\t\t\t\t\tresultSet[k] = !!object[k];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tresultSet[object.toString()] = true;\n\t\t\t}\n\t\t}\n\n\t\tvar SPACE = /\\s+/;\n\t\tfunction _parseString (resultSet, str) {\n\t\t\tvar array = str.split(SPACE);\n\t\t\tvar length = array.length;\n\n\t\t\tfor (var i = 0; i < length; ++i) {\n\t\t\t\tresultSet[array[i]] = true;\n\t\t\t}\n\t\t}\n\n\t\tfunction _parse (resultSet, arg) {\n\t\t\tif (!arg) return;\n\t\t\tvar argType = typeof arg;\n\n\t\t\t// 'foo bar'\n\t\t\tif (argType === 'string') {\n\t\t\t\t_parseString(resultSet, arg);\n\n\t\t\t// ['foo', 'bar', ...]\n\t\t\t} else if (Array.isArray(arg)) {\n\t\t\t\t_parseArray(resultSet, arg);\n\n\t\t\t// { 'foo': true, ... }\n\t\t\t} else if (argType === 'object') {\n\t\t\t\t_parseObject(resultSet, arg);\n\n\t\t\t// '130'\n\t\t\t} else if (argType === 'number') {\n\t\t\t\t_parseNumber(resultSet, arg);\n\t\t\t}\n\t\t}\n\n\t\tfunction _classNames () {\n\t\t\t// don't leak arguments\n\t\t\t// https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments\n\t\t\tvar len = arguments.length;\n\t\t\tvar args = Array(len);\n\t\t\tfor (var i = 0; i < len; i++) {\n\t\t\t\targs[i] = arguments[i];\n\t\t\t}\n\n\t\t\tvar classSet = new StorageObject();\n\t\t\t_parseArray(classSet, args);\n\n\t\t\tvar list = [];\n\n\t\t\tfor (var k in classSet) {\n\t\t\t\tif (classSet[k]) {\n\t\t\t\t\tlist.push(k)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn list.join(' ');\n\t\t}\n\n\t\treturn _classNames;\n\t})();\n\n\tif (typeof module !== 'undefined' && module.exports) {\n\t\tclassNames.default = classNames;\n\t\tmodule.exports = classNames;\n\t} else if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {\n\t\t// register as 'classnames', consistent with npm package name\n\t\tdefine('classnames', [], function () {\n\t\t\treturn classNames;\n\t\t});\n\t} else {\n\t\twindow.classNames = classNames;\n\t}\n}());\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","export const DEFAULT_ATTRS = {\n xmlns: 'http://www.w3.org/2000/svg'\n};\n\nexport const REACTIVE_NATIVE_ATTRS = {\n width: 50,\n height: 50,\n fill: 'orange'\n};\n\nexport default DEFAULT_ATTRS;\n","import classnames from 'classnames/dedupe';\n\nimport { DEFAULT_ATTRS, REACTIVE_NATIVE_ATTRS } from './default-attrs';\n\n\nclass Icon {\n constructor (name, contents, attrs, pathPrefix) {\n this.name = name;\n this.contents = contents;\n this.attrs = {\n ...DEFAULT_ATTRS,\n ...attrs\n };\n if (pathPrefix !== undefined && pathPrefix !== '') {\n this.pathPrefix = pathPrefix;\n }\n }\n\n /**\n * Create an SVG string.\n * @param {Object} attrs\n * @param {String} platform - Identifier for platform specific attrs to be included/excluded\n * @returns {string}\n */\n toSvg (attrs = {}, platform = 'default') {\n const normalisedClassname = normaliseClassname(this.name);\n\n const classname = classnames('c-pieIcon', `c-pieIcon--${normalisedClassname}`, this.attrs.class, attrs.class);\n\n const combinedAttrs = {\n ...this.attrs,\n ...attrs,\n ...(platform === 'default' ? { class: classname } : {}), // don't include classes when not using the default attrs\n ...(platform === 'reactNative' ? REACTIVE_NATIVE_ATTRS : {})\n };\n\n return `<svg ${attrsToString(combinedAttrs)}>${this.contents}</svg>`;\n }\n}\n\n/**\n * Normalises a string into camelCase format\n * E.g. alert-circle-filled > alertCircleFilled\n *\n * @param {String} classname – the class to be normalised\n * @returns {String}\n */\nexport function normaliseClassname (classname) {\n // Split name by dashes into an array\n const splitClassname = classname.split('-');\n\n // then map these such that the first index is lowercase and the rest are Uppercased\n const camelCaseClassnames = splitClassname.map((name, index) => (\n (index === 0)\n ? name.substring(0, 1).toLowerCase() + (name).substring(1)\n : name.substring(0, 1).toUpperCase() + (name).substring(1)));\n\n return camelCaseClassnames.join('');\n}\n\n/**\n * Convert attributes object to string of HTML attributes.\n * @param {Object} attrs\n * @returns {string}\n */\nfunction attrsToString (attrs) {\n return Object.keys(attrs)\n .map(key => `${key}=\"${attrs[key]}\"`)\n .join(' ');\n}\n\nexport default Icon;\n","import Icon from './icon';\nimport icons from '../dist/icons.json'; // eslint-disable-line import/no-unresolved\n\nexport default Object.keys(icons)\n .map(key => new Icon(key, icons[key].contents, icons[key].attrs, icons[key].pathPrefix))\n .reduce((object, icon) => {\n object[icon.name] = icon;\n return object;\n }, {});\n","/* eslint-env browser */\nimport classnames from 'classnames/dedupe';\n\nimport icons from './icons';\n\n/**\n * Replace all HTML elements that have a `data-pie-icons` attribute with SVG markup\n * corresponding to the element's `data-pie-icons` attribute value.\n * @param {Object} attrs\n */\nfunction replace (attrs = {}) {\n if (typeof document === 'undefined') {\n throw new Error('`pie-icons.replace()` only works in a browser environment.');\n }\n\n const elementsToReplace = document.querySelectorAll('[data-pie-icons]');\n\n Array.from(elementsToReplace).forEach(element => replaceElement(element, attrs));\n}\n\n/**\n * Replace a single HTML element with SVG markup\n * corresponding to the element's `data-pie-icons` attribute value.\n * @param {HTMLElement} element\n * @param {Object} attrs\n */\nfunction replaceElement (element, attrs = {}) {\n const elementAttrs = getAttrs(element);\n const name = elementAttrs['data-pie-icons'];\n delete elementAttrs['data-pie-icons'];\n\n const svgString = icons[name].toSvg({\n ...attrs,\n ...elementAttrs,\n ...{ class: classnames(attrs.class, elementAttrs.class) }\n });\n const svgDocument = new DOMParser().parseFromString(\n svgString,\n 'image/svg+xml'\n );\n const svgElement = svgDocument.querySelector('svg');\n\n element.parentNode.replaceChild(svgElement, element);\n}\n\n/**\n * Get the attributes of an HTML element.\n * @param {HTMLElement} element\n * @returns {Object}\n */\nfunction getAttrs (element) {\n return Array.from(element.attributes).reduce((attrs, attr) => {\n attrs[attr.name] = attr.value;\n return attrs;\n }, {});\n}\n\nexport default replace;\n","import icons from './icons';\nimport replace from './replace';\n\nexport default { icons, replace };\n"],"names":["root","factory","exports","module","define","amd","self","this","classNames","StorageObject","_parseArray","resultSet","array","length","i","_parse","prototype","Object","create","hasOwn","hasOwnProperty","SPACE","arg","argType","str","split","_parseString","Array","isArray","object","toString","k","call","_parseObject","num","_parseNumber","len","arguments","args","classSet","list","push","join","default","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","n","getter","__esModule","d","a","definition","key","o","defineProperty","enumerable","get","obj","prop","r","Symbol","toStringTag","value","DEFAULT_ATTRS","xmlns","REACTIVE_NATIVE_ATTRS","width","height","fill","Icon","name","contents","attrs","pathPrefix","_classCallCheck","_objectSpread","platform","normalisedClassname","classname","map","index","substring","toLowerCase","toUpperCase","normaliseClassname","classnames","concat","combinedAttrs","class","keys","attrsToString","icons","reduce","icon","replace","document","Error","elementsToReplace","querySelectorAll","from","forEach","element","elementAttrs","attributes","attr","getAttrs","svgString","toSvg","svgElement","DOMParser","parseFromString","querySelector","parentNode","replaceChild","replaceElement"],"sourceRoot":""}
|
|
1
|
+
{"version":3,"file":"pie-icons.min.js","mappings":";CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,GAAIH,GACe,iBAAZC,QACdA,QAAQ,aAAeD,IAEvBD,EAAK,aAAeC,GACrB,CATD,CASmB,oBAATK,KAAuBA,KAAOC,MAAM,WAC9C,+BCVA,OAOC,WACA,aAEA,IAAIC,EAAa,WAGhB,SAASC,IAAiB,CAG1B,SAASC,EAAaC,EAAWC,GAGhC,IAFA,IAAIC,EAASD,EAAMC,OAEVC,EAAI,EAAGA,EAAID,IAAUC,EAC7BC,EAAOJ,EAAWC,EAAME,GAE1B,CARAL,EAAcO,UAAYC,OAAOC,OAAO,MAUxC,IAAIC,EAAS,CAAC,EAAEC,eAoBZC,EAAQ,MAUZ,SAASN,EAAQJ,EAAWW,GAC3B,GAAKA,EAAL,CACA,IAAIC,SAAiBD,EAGL,WAAZC,EAdL,SAAuBZ,EAAWa,GAIjC,IAHA,IAAIZ,EAAQY,EAAIC,MAAMJ,GAClBR,EAASD,EAAMC,OAEVC,EAAI,EAAGA,EAAID,IAAUC,EAC7BH,EAAUC,EAAME,KAAM,CAExB,CAQEY,CAAaf,EAAWW,GAGdK,MAAMC,QAAQN,GACxBZ,EAAYC,EAAWW,GAGD,WAAZC,EArCZ,SAAuBZ,EAAWkB,GACjC,GAAIA,EAAOC,WAAab,OAAOD,UAAUc,SACxC,IAAK,IAAIC,KAAKF,EACTV,EAAOa,KAAKH,EAAQE,KAGvBpB,EAAUoB,KAAOF,EAAOE,SAI1BpB,EAAUkB,EAAOC,aAAc,CAEjC,CA0BEG,CAAatB,EAAWW,GAGF,WAAZC,GA7CZ,SAAuBZ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Y,UAM9CM,GAJc,IAAIC,WAAYC,gBAChCJ,EACA,iBAE2BK,cAAc,OAE7CV,EAAQW,WAAWC,aAAaL,EAAYP,EAChD,CA1BuDa,CAAeb,EAAS7B,EAAM,GACrF","sources":["webpack://pie-icons/webpack/universalModuleDefinition","webpack://pie-icons/../../../node_modules/classnames/dedupe.js","webpack://pie-icons/webpack/bootstrap","webpack://pie-icons/webpack/runtime/compat get default export","webpack://pie-icons/webpack/runtime/define property getters","webpack://pie-icons/webpack/runtime/hasOwnProperty shorthand","webpack://pie-icons/webpack/runtime/make namespace object","webpack://pie-icons/./src/default-attrs.js","webpack://pie-icons/./src/icon.js","webpack://pie-icons/./src/icons.js","webpack://pie-icons/./src/replace.js","webpack://pie-icons/./src/index.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[\"pie-icons\"] = factory();\n\telse\n\t\troot[\"pie-icons\"] = factory();\n})(typeof self !== 'undefined' ? self : this, function() {\nreturn ","/*!\n Copyright (c) 2018 Jed Watson.\n Licensed under the MIT License (MIT), see\n http://jedwatson.github.io/classnames\n*/\n/* global define */\n\n(function () {\n\t'use strict';\n\n\tvar classNames = (function () {\n\t\t// don't inherit from Object so we can skip hasOwnProperty check later\n\t\t// http://stackoverflow.com/questions/15518328/creating-js-object-with-object-createnull#answer-21079232\n\t\tfunction StorageObject() {}\n\t\tStorageObject.prototype = Object.create(null);\n\n\t\tfunction _parseArray (resultSet, array) {\n\t\t\tvar length = array.length;\n\n\t\t\tfor (var i = 0; i < length; ++i) {\n\t\t\t\t_parse(resultSet, array[i]);\n\t\t\t}\n\t\t}\n\n\t\tvar hasOwn = {}.hasOwnProperty;\n\n\t\tfunction _parseNumber (resultSet, num) {\n\t\t\tresultSet[num] = true;\n\t\t}\n\n\t\tfunction _parseObject (resultSet, object) {\n\t\t\tif (object.toString === Object.prototype.toString) {\n\t\t\t\tfor (var k in object) {\n\t\t\t\t\tif (hasOwn.call(object, k)) {\n\t\t\t\t\t\t// set value to false instead of deleting it to avoid changing object structure\n\t\t\t\t\t\t// https://www.smashingmagazine.com/2012/11/writing-fast-memory-efficient-javascript/#de-referencing-misconceptions\n\t\t\t\t\t\tresultSet[k] = !!object[k];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tresultSet[object.toString()] = true;\n\t\t\t}\n\t\t}\n\n\t\tvar SPACE = /\\s+/;\n\t\tfunction _parseString (resultSet, str) {\n\t\t\tvar array = str.split(SPACE);\n\t\t\tvar length = array.length;\n\n\t\t\tfor (var i = 0; i < length; ++i) {\n\t\t\t\tresultSet[array[i]] = true;\n\t\t\t}\n\t\t}\n\n\t\tfunction _parse (resultSet, arg) {\n\t\t\tif (!arg) return;\n\t\t\tvar argType = typeof arg;\n\n\t\t\t// 'foo bar'\n\t\t\tif (argType === 'string') {\n\t\t\t\t_parseString(resultSet, arg);\n\n\t\t\t// ['foo', 'bar', ...]\n\t\t\t} else if (Array.isArray(arg)) {\n\t\t\t\t_parseArray(resultSet, arg);\n\n\t\t\t// { 'foo': true, ... }\n\t\t\t} else if (argType === 'object') {\n\t\t\t\t_parseObject(resultSet, arg);\n\n\t\t\t// '130'\n\t\t\t} else if (argType === 'number') {\n\t\t\t\t_parseNumber(resultSet, arg);\n\t\t\t}\n\t\t}\n\n\t\tfunction _classNames () {\n\t\t\t// don't leak arguments\n\t\t\t// https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments\n\t\t\tvar len = arguments.length;\n\t\t\tvar args = Array(len);\n\t\t\tfor (var i = 0; i < len; i++) {\n\t\t\t\targs[i] = arguments[i];\n\t\t\t}\n\n\t\t\tvar classSet = new StorageObject();\n\t\t\t_parseArray(classSet, args);\n\n\t\t\tvar list = [];\n\n\t\t\tfor (var k in classSet) {\n\t\t\t\tif (classSet[k]) {\n\t\t\t\t\tlist.push(k)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn list.join(' ');\n\t\t}\n\n\t\treturn _classNames;\n\t})();\n\n\tif (typeof module !== 'undefined' && module.exports) {\n\t\tclassNames.default = classNames;\n\t\tmodule.exports = classNames;\n\t} else if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {\n\t\t// register as 'classnames', consistent with npm package name\n\t\tdefine('classnames', [], function () {\n\t\t\treturn classNames;\n\t\t});\n\t} else {\n\t\twindow.classNames = classNames;\n\t}\n}());\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","export const DEFAULT_ATTRS = {\n xmlns: 'http://www.w3.org/2000/svg',\n};\n\nexport const REACTIVE_NATIVE_ATTRS = {\n width: 50,\n height: 50,\n fill: 'orange',\n};\n\nexport default DEFAULT_ATTRS;\n","import classnames from 'classnames/dedupe';\n\nimport { DEFAULT_ATTRS, REACTIVE_NATIVE_ATTRS } from './default-attrs';\n\nclass Icon {\n constructor (name, contents, attrs, pathPrefix) {\n this.name = name;\n this.contents = contents;\n this.attrs = {\n ...DEFAULT_ATTRS,\n ...attrs,\n };\n if (pathPrefix !== undefined && pathPrefix !== '') {\n this.pathPrefix = pathPrefix;\n }\n }\n\n /**\n * Create an SVG string.\n * @param {Object} attrs\n * @param {String} platform - Identifier for platform specific attrs to be included/excluded\n * @returns {string}\n */\n toSvg (attrs = {}, platform = 'default') {\n const normalisedClassname = normaliseClassname(this.name);\n\n const classname = classnames('c-pieIcon', `c-pieIcon--${normalisedClassname}`, this.attrs.class, attrs.class);\n\n const combinedAttrs = {\n ...this.attrs,\n ...attrs,\n ...(platform === 'default' ? { class: classname } : {}), // don't include classes when not using the default attrs\n ...(platform === 'reactNative' ? REACTIVE_NATIVE_ATTRS : {}),\n };\n\n return `<svg ${attrsToString(combinedAttrs)}>${this.contents}</svg>`;\n }\n}\n\n/**\n * Normalises a string into camelCase format\n * E.g. alert-circle-filled > alertCircleFilled\n *\n * @param {String} classname – the class to be normalised\n * @returns {String}\n */\nexport function normaliseClassname (classname) {\n // Split name by dashes into an array\n const splitClassname = classname.split('-');\n\n // then map these such that the first index is lowercase and the rest are Uppercased\n const camelCaseClassnames = splitClassname.map((name, index) => (\n (index === 0)\n ? name.substring(0, 1).toLowerCase() + (name).substring(1)\n : name.substring(0, 1).toUpperCase() + (name).substring(1)));\n\n return camelCaseClassnames.join('');\n}\n\n/**\n * Convert attributes object to string of HTML attributes.\n * @param {Object} attrs\n * @returns {string}\n */\nfunction attrsToString (attrs) {\n return Object.keys(attrs)\n .map((key) => `${key}=\"${attrs[key]}\"`)\n .join(' ');\n}\n\nexport default Icon;\n","import Icon from './icon';\nimport icons from '../dist/icons.json'; // eslint-disable-line import/no-unresolved\n\nexport default Object.keys(icons)\n .map((key) => new Icon(key, icons[key].contents, icons[key].attrs, icons[key].pathPrefix))\n .reduce((object, icon) => {\n object[icon.name] = icon;\n return object;\n }, {});\n","/* eslint-env browser */\nimport classnames from 'classnames/dedupe';\n\nimport icons from './icons';\n\n/**\n * Replace all HTML elements that have a `data-pie-icons` attribute with SVG markup\n * corresponding to the element's `data-pie-icons` attribute value.\n * @param {Object} attrs\n */\nfunction replace (attrs = {}) {\n if (typeof document === 'undefined') {\n throw new Error('`pie-icons.replace()` only works in a browser environment.');\n }\n\n const elementsToReplace = document.querySelectorAll('[data-pie-icons]');\n\n Array.from(elementsToReplace).forEach((element) => replaceElement(element, attrs));\n}\n\n/**\n * Replace a single HTML element with SVG markup\n * corresponding to the element's `data-pie-icons` attribute value.\n * @param {HTMLElement} element\n * @param {Object} attrs\n */\nfunction replaceElement (element, attrs = {}) {\n const elementAttrs = getAttrs(element);\n const name = elementAttrs['data-pie-icons'];\n delete elementAttrs['data-pie-icons'];\n\n const svgString = icons[name].toSvg({\n ...attrs,\n ...elementAttrs,\n ...{ class: classnames(attrs.class, elementAttrs.class) },\n });\n const svgDocument = new DOMParser().parseFromString(\n svgString,\n 'image/svg+xml',\n );\n const svgElement = svgDocument.querySelector('svg');\n\n element.parentNode.replaceChild(svgElement, element);\n}\n\n/**\n * Get the attributes of an HTML element.\n * @param {HTMLElement} element\n * @returns {Object}\n */\nfunction getAttrs (element) {\n return Array.from(element.attributes).reduce((attrs, attr) => {\n attrs[attr.name] = attr.value;\n return attrs;\n }, {});\n}\n\nexport default replace;\n","import icons from './icons';\nimport replace from './replace';\n\nexport default { icons, replace };\n"],"names":["root","factory","exports","module","define","amd","self","this","classNames","StorageObject","_parseArray","resultSet","array","length","i","_parse","prototype","Object","create","hasOwn","hasOwnProperty","SPACE","arg","argType","str","split","_parseString","Array","isArray","object","toString","k","call","_parseObject","num","_parseNumber","len","arguments","args","classSet","list","push","join","default","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","n","getter","__esModule","d","a","definition","key","o","defineProperty","enumerable","get","obj","prop","r","Symbol","toStringTag","value","DEFAULT_ATTRS","xmlns","REACTIVE_NATIVE_ATTRS","width","height","fill","Icon","name","contents","attrs","pathPrefix","_classCallCheck","_objectSpread","platform","normalisedClassname","classname","map","index","substring","toLowerCase","toUpperCase","normaliseClassname","classnames","concat","combinedAttrs","class","keys","attrsToString","icons","reduce","icon","replace","document","Error","elementsToReplace","querySelectorAll","from","forEach","element","elementAttrs","attributes","attr","getAttrs","svgString","toSvg","svgElement","DOMParser","parseFromString","querySelector","parentNode","replaceChild","replaceElement"],"sourceRoot":""}
|
package/package.json
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@justeattakeaway/pie-icons",
|
|
3
|
-
"version": "2.0.
|
|
4
|
-
"tag": "beta",
|
|
3
|
+
"version": "2.0.1",
|
|
5
4
|
"description": "Common icons for use for PIE Project",
|
|
6
5
|
"main": "dist/pie-icons.js",
|
|
7
6
|
"license": "Apache-2.0",
|
|
@@ -41,5 +40,8 @@
|
|
|
41
40
|
},
|
|
42
41
|
"jest": {
|
|
43
42
|
"testEnvironment": "jsdom"
|
|
43
|
+
},
|
|
44
|
+
"volta": {
|
|
45
|
+
"extends": "../../../package.json"
|
|
44
46
|
}
|
|
45
47
|
}
|