1 line
13 KiB
Plaintext
1 line
13 KiB
Plaintext
{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap","webpack:///./projects/icons/src/clr-icons-api.ts","webpack:///./projects/icons/src/utils/shape-template-observer.ts"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;QCVA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;;;;;;;AClFA;;;;GAIG;;;AAGH,oJAAwE;AAExE,IAAM,gBAAgB,GAAqB,EAAE,CAAC;AAE9C;IAAA;IA6GA,CAAC;IA1GC,sBAAW,2BAAQ;aAAnB;YACE,IAAI,CAAC,eAAe,CAAC,cAAc,EAAE;gBACnC,eAAe,CAAC,cAAc,GAAG,IAAI,eAAe,EAAE,CAAC;aACxD;YAED,OAAO,eAAe,CAAC,cAAc,CAAC;QACxC,CAAC;;;OAAA;IAEO,sCAAY,GAApB,UAAqB,IAAY;QAC/B,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE;YACrB,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;SACpE;QAED,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CA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CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,UAAC,qBAA6C;gBAC1E,qBAAqB,CAAC,QAAQ,CAAC,CAAC;YAClC,CAAC,CAAC,CAAC;SACJ;IACH,CAAC;IACH,4BAAC;AAAD,CAAC;AA3CY,sDAAqB","file":"clr-icons-api.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 {\n\t\tvar a = factory();\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(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 = \"./projects/icons/src/clr-icons-api.ts\");\n","/*\n * Copyright (c) 2016-2021 VMware, Inc. All Rights Reserved.\n * This software is released under MIT license.\n * The full license information can be found in LICENSE in the root directory of this project.\n */\n\nimport { IconAlias, IconShapeSources } from './interfaces/icon-interfaces';\nimport { ShapeTemplateObserver } from './utils/shape-template-observer';\n\nconst iconShapeSources: IconShapeSources = {};\n\nexport class ClarityIconsApi {\n private static singleInstance: ClarityIconsApi;\n\n static get instance(): ClarityIconsApi {\n if (!ClarityIconsApi.singleInstance) {\n ClarityIconsApi.singleInstance = new ClarityIconsApi();\n }\n\n return ClarityIconsApi.singleInstance;\n }\n\n private validateName(name: string): boolean {\n if (name.length === 0) {\n throw new Error('Shape name or alias must be a non-empty string!');\n }\n\n if (/\\s/.test(name)) {\n throw new Error('Shape name or alias must not contain any whitespace characters!');\n }\n\n return true;\n }\n\n private normalizeShapeName(shapeName: string) {\n return shapeName.toLowerCase();\n }\n\n private setIconTemplate(shapeName: string, shapeTemplate: string): void {\n const trimmedShapeTemplate = shapeTemplate.trim();\n\n if (this.validateName(shapeName)) {\n // Make sure the shapeName don't contain uppercase characters\n // when registering it\n shapeName = this.normalizeShapeName(shapeName);\n\n // if the shape name exists, delete it.\n if (iconShapeSources[shapeName]) {\n delete iconShapeSources[shapeName];\n }\n\n iconShapeSources[shapeName] = trimmedShapeTemplate;\n\n ShapeTemplateObserver.instance.emitChanges(shapeName, trimmedShapeTemplate);\n }\n }\n\n private setIconAliases(templates: IconShapeSources, shapeName: string, aliasNames: string[]): void {\n for (const aliasName of aliasNames) {\n if (this.validateName(aliasName)) {\n Object.defineProperty(templates, aliasName, {\n get: function () {\n return templates[shapeName];\n },\n enumerable: true,\n configurable: true,\n });\n }\n }\n }\n\n add(icons?: IconShapeSources): void {\n if (typeof icons !== 'object') {\n throw new Error(`The argument must be an object literal passed in the following pattern:\n { \"shape-name\": \"shape-template\" }`);\n }\n\n for (const shapeName in icons) {\n if (icons.hasOwnProperty(shapeName)) {\n this.setIconTemplate(shapeName, icons[shapeName]);\n }\n }\n }\n\n has(shapeName: string): boolean {\n return !!iconShapeSources[this.normalizeShapeName(shapeName)];\n }\n\n get(shapeName?: string): any {\n // if shapeName is not given, return all icon templates.\n if (!shapeName) {\n return iconShapeSources;\n }\n\n if (typeof shapeName !== 'string') {\n throw new TypeError('Only string argument is allowed in this method.');\n }\n\n return iconShapeSources[this.normalizeShapeName(shapeName)];\n }\n\n alias(aliases?: IconAlias): void {\n if (typeof aliases !== 'object') {\n throw new Error(`The argument must be an object literal passed in the following pattern:\n { \"shape-name\": [\"alias-name\", ...] }`);\n }\n\n for (const shapeName in aliases) {\n if (aliases.hasOwnProperty(shapeName)) {\n if (iconShapeSources.hasOwnProperty(shapeName)) {\n // set an alias to the icon if it exists in iconShapeSources.\n this.setIconAliases(iconShapeSources, shapeName, aliases[shapeName]);\n } else {\n throw new Error(\n `An icon \"${shapeName}\" you are trying to set aliases to doesn't exist in the Clarity Icons sets!`\n );\n }\n }\n }\n }\n}\n","/**\n * Copyright (c) 2016-2021 VMware, Inc. All Rights Reserved.\n * This software is released under MIT license.\n * The full license information can be found in LICENSE in the root directory of this project.\n */\nimport { ShapeTemplateObservables } from '../interfaces/icon-interfaces';\n\nexport const changeHandlerCallbacks: ShapeTemplateObservables = {};\n\nexport class ShapeTemplateObserver {\n private static singleInstance: ShapeTemplateObserver;\n\n private callbacks: ShapeTemplateObservables = changeHandlerCallbacks;\n\n public static get instance(): ShapeTemplateObserver {\n if (!ShapeTemplateObserver.singleInstance) {\n ShapeTemplateObserver.singleInstance = new ShapeTemplateObserver();\n }\n\n return ShapeTemplateObserver.singleInstance;\n }\n\n public subscribeTo(shapeName: string, changeHandlerCallback: (arg0: string) => void) {\n if (!this.callbacks[shapeName]) {\n this.callbacks[shapeName] = [changeHandlerCallback];\n } else {\n if (this.callbacks[shapeName].indexOf(changeHandlerCallback) === -1) {\n this.callbacks[shapeName].push(changeHandlerCallback);\n }\n }\n\n // this returned function give users an ability to remove the subscription\n return () => {\n const removeAt = this.callbacks[shapeName].indexOf(changeHandlerCallback);\n this.callbacks[shapeName].splice(removeAt, 1);\n\n // if the array is empty, remove the property from the callbacks\n if (this.callbacks[shapeName].length === 0) {\n delete this.callbacks[shapeName];\n }\n };\n }\n\n public emitChanges(shapeName: string, template: string) {\n if (this.callbacks[shapeName]) {\n // this will emit changes to all observers\n // by calling their callback functions on template changes\n this.callbacks[shapeName].map((changeHandlerCallback: (arg0: string) => void) => {\n changeHandlerCallback(template);\n });\n }\n }\n}\n"],"sourceRoot":""} |