@splunk/visualizations-shared 23.3.0 → 24.0.0

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.
Files changed (45) hide show
  1. package/.loki/reference/chrome_docker_SizeAwareWrapper_Fix_size_container.png +0 -0
  2. package/.loki/reference/chrome_docker_SizeAwareWrapper_Flex_layout_container.png +0 -0
  3. package/.loki/reference/chrome_docker_SizeAwareWrapper_Flex_layout_container_with_extra_wrapper.png +0 -0
  4. package/Downloader.js +8 -5
  5. package/Downloader.js.map +1 -1
  6. package/FileDownloader.js +23 -18
  7. package/FileDownloader.js.map +1 -1
  8. package/Message.js +2 -2
  9. package/Message.js.map +1 -1
  10. package/RemoteIcon.js +6 -5
  11. package/RemoteIcon.js.map +1 -1
  12. package/RemoteImage.js +3 -2
  13. package/RemoteImage.js.map +1 -1
  14. package/SanitizeProps.js +8 -5
  15. package/SanitizeProps.js.map +1 -1
  16. package/SizeAwareWrapper.js +2 -2
  17. package/SizeAwareWrapper.js.map +1 -1
  18. package/VisualizationDocPage.js +40 -6
  19. package/VisualizationDocPage.js.map +1 -1
  20. package/colorConstants.js +4 -4
  21. package/colorConstants.js.map +1 -1
  22. package/colorUtils.js +3 -2
  23. package/colorUtils.js.map +1 -1
  24. package/console.js +2 -2
  25. package/dataSourceUtils.js +2 -2
  26. package/dataSourceUtils.js.map +1 -1
  27. package/domUtils.js +4 -4
  28. package/domUtils.js.map +1 -1
  29. package/i18n.js +2 -2
  30. package/i18n.js.map +1 -1
  31. package/loki.config.js +10 -0
  32. package/numberUtils.js +4 -4
  33. package/numberUtils.js.map +1 -1
  34. package/package.json +11 -14
  35. package/previewVizMessage.js +110 -0
  36. package/previewVizMessage.js.map +1 -0
  37. package/propUtils.js +4 -4
  38. package/propUtils.js.map +1 -1
  39. package/simpleXMLOptions.js +4 -4
  40. package/simpleXMLOptions.js.map +1 -1
  41. package/testHelper.js +2 -2
  42. package/testHelper.js.map +1 -1
  43. package/themeUtils.js +6 -6
  44. package/themeUtils.js.map +1 -1
  45. package/tests/visual.test.js +0 -39
package/Downloader.js CHANGED
@@ -156,13 +156,16 @@ Object.defineProperty(exports, "__esModule", {
156
156
  value: true
157
157
  });
158
158
  exports.URLDownloader = exports.ImageRegistryFetcher = exports.b64DecodeUnicode = void 0;
159
+ /* eslint-disable max-classes-per-file */
160
+
161
+ /* eslint-disable class-methods-use-this */
159
162
 
160
163
  var i18n_1 = __webpack_require__(7);
161
164
 
162
165
  var b64DecodeUnicode = function b64DecodeUnicode(base64Data) {
163
- //from bytestream, to percent-encoding, to original string.
166
+ // from bytestream, to percent-encoding, to original string.
164
167
  return decodeURIComponent(atob(base64Data).split('').map(function (c) {
165
- return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
168
+ return "%".concat("00".concat(c.charCodeAt(0).toString(16)).slice(-2));
166
169
  }).join(''));
167
170
  };
168
171
 
@@ -286,7 +289,7 @@ var URLDownloader = /*#__PURE__*/function () {
286
289
  chunks.push(value);
287
290
  bytesDownloaded += value.length;
288
291
  progress({
289
- //call the progress callback...can enable the UI to show progress
292
+ // call the progress callback...can enable the UI to show progress
290
293
  bytesDownloaded: bytesDownloaded,
291
294
  contentLength: contentLength,
292
295
  message: "Received ".concat(bytesDownloaded, " bytes of ").concat(contentLength || 'unknown size')
@@ -299,7 +302,7 @@ var URLDownloader = /*#__PURE__*/function () {
299
302
  case 19:
300
303
  // Step 4: concatenate chunks into single Uint8Array
301
304
  chunksAll = new Uint8Array(bytesDownloaded);
302
- position = 0;
305
+ position = 0; // eslint-disable-next-line no-restricted-syntax
303
306
 
304
307
  for (_i = 0, _chunks = chunks; _i < _chunks.length; _i++) {
305
308
  chunk = _chunks[_i];
@@ -314,7 +317,7 @@ var URLDownloader = /*#__PURE__*/function () {
314
317
  }); // Step 5: decode into a string
315
318
 
316
319
  svg = new TextDecoder('utf-8').decode(chunksAll);
317
- complete(svg); //show the downloaded svg back to the caller via its completion callback
320
+ complete(svg); // show the downloaded svg back to the caller via its completion callback
318
321
 
319
322
  case 25:
320
323
  case "end":
package/Downloader.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"@babel/runtime/regenerator\"","webpack:///external \"@babel/runtime/helpers/slicedToArray\"","webpack:///./src/Downloader.ts","webpack:///external \"@babel/runtime/helpers/classCallCheck\"","webpack:///external \"@babel/runtime/helpers/createClass\"","webpack:///external \"@splunk/ui-utils/i18n\""],"names":[],"mappings":";;;;;;;QAAA;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,uD;;;;;;;ACAA,iE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACAA;;AAiBO,IAAM,gBAAgB,GAAG,SAAnB,gBAAmB,CAAC,UAAD,EAA+B;AAC3D;AACA,SAAO,kBAAkB,CACrB,IAAI,CAAC,UAAD,CAAJ,CACK,KADL,CACW,EADX,EAEK,GAFL,CAES,UAAC,CAAD,EAAsB;AACvB,WAAO,MAAM,CAAC,OAAO,CAAC,CAAC,UAAF,CAAa,CAAb,EAAgB,QAAhB,CAAyB,EAAzB,CAAR,EAAsC,KAAtC,CAA4C,CAA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AA7CL,6B;;;;;;;AChIA,kE;;;;;;;ACAA,+D;;;;;;;ACAA,kD","file":"Downloader.js","sourcesContent":[" \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 = 27);\n","module.exports = require(\"@babel/runtime/regenerator\");","module.exports = require(\"@babel/runtime/helpers/slicedToArray\");","import { _ } from '@splunk/ui-utils/i18n';\nimport ImageRegistry from '@splunk/visualization-context/ImageRegistry';\n\nexport interface DownloadProgress {\n bytesDownloaded: number;\n contentLength?: number;\n message: string;\n}\nexport interface IDownloader {\n downloadWithProgress(\n url: string,\n complete: (svg: string) => void,\n progress?: (p: DownloadProgress) => void,\n error?: (msg: string, error?: Error) => void\n ): void;\n}\n\nexport const b64DecodeUnicode = (base64Data: string): string => {\n //from bytestream, to percent-encoding, to original string.\n return decodeURIComponent(\n atob(base64Data)\n .split('')\n .map((c: string): string => {\n return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);\n })\n .join('')\n );\n};\n\nexport class ImageRegistryFetcher implements IDownloader {\n context: ImageRegistry;\n constructor(context?: ImageRegistry) {\n this.context = context;\n }\n async downloadWithProgress(\n url: string,\n complete: (svg: string) => void,\n progress?: (p: DownloadProgress) => void,\n error?: (msg: string, error?: Error) => void\n ): Promise<void> {\n const imageRegistry = this.context;\n if (!imageRegistry) {\n error(_('Missing Image Context'));\n }\n try {\n const imageData = await imageRegistry.getByURL(url);\n const [mime, svgBase64] = imageData.dataURI.split('base64,');\n if (mime && mime.toLowerCase().indexOf('image/svg+xml') > -1) {\n complete(b64DecodeUnicode(svgBase64));\n } else {\n error(_(`Unsupported MIME type ${mime} for url ${url}`));\n }\n } catch (e) {\n error(_(`Error retrieving ${url} from Image Registry, error was '${e.message}'`), e);\n }\n }\n}\n\nexport class URLDownloader implements IDownloader {\n downloadWithProgress(\n url: string,\n complete: (svg: string) => void,\n progress?: (p: DownloadProgress) => void,\n error?: (msg: string, error?: Error) => void\n ): void {\n // Step 1: fetch content from URL, get reader\n fetch(url)\n .then(\n async (response: Response): Promise<void> => {\n if (!response.ok) {\n const msg = `Fetch not Ok for ${url}, status was '${response.statusText}'`;\n console.warn(msg);\n error(msg);\n return;\n }\n const reader = response.body.getReader();\n\n // Step 2: get total length\n const contentLength = +response.headers.get('Content-Length');\n\n // Step 3: read the data\n let bytesDownloaded = 0; // length at the moment\n const chunks = []; // array of received binary chunks (comprises the body)\n let done = false;\n while (!done) {\n const res = await reader.read();\n done = res.done;\n const { value } = res;\n if (value) {\n chunks.push(value);\n bytesDownloaded += value.length;\n progress({\n //call the progress callback...can enable the UI to show progress\n bytesDownloaded,\n contentLength,\n message: `Received ${bytesDownloaded} bytes of ${\n contentLength || 'unknown size'\n }`,\n });\n }\n }\n\n // Step 4: concatenate chunks into single Uint8Array\n const chunksAll = new Uint8Array(bytesDownloaded);\n let position = 0;\n for (const chunk of chunks) {\n chunksAll.set(chunk, position);\n position += chunk.length;\n }\n\n progress({\n bytesDownloaded,\n contentLength,\n message: 'decoding chunks',\n });\n\n // Step 5: decode into a string\n const svg = new TextDecoder('utf-8').decode(chunksAll);\n complete(svg); //show the downloaded svg back to the caller via its completion callback\n }\n )\n .catch((e: Error): void => {\n console.error(e.toString());\n error(`Fetch error for '${url}', error was '${e.toString()}'`, e); // call the supplied error handling function\n });\n }\n}\n\nexport default class Downloader {\n private downloaders = {};\n constructor(downloaders: { [protocol: string]: IDownloader }) {\n this.downloaders = downloaders;\n }\n\n downloadWithProgress(\n url: string,\n complete: (svg: string) => void,\n progress?: (p: DownloadProgress) => void,\n error?: (msg: string, error?: Error) => void\n ): void {\n // url is the following:\n // data:image/svg+xml;base64....\n // http://\n // https://\n // local://\n // or otherwise return errors\n\n let protocol = '';\n let isUrl = true;\n try {\n protocol = new URL(url).protocol;\n } catch (e) {\n isUrl = false;\n }\n\n if (isUrl) {\n try {\n const [type = ''] = protocol.split(':');\n if (this.downloaders[type]) {\n // data, http(s), local....\n this.downloaders[type].downloadWithProgress(url, complete, progress, error);\n } else {\n // unknown type\n error(`Unsupported URL protocol '${type}' for SVG download: ${url}`);\n }\n } catch (e) {\n error(`Unexpected error downloading SVG: ${e.message}`);\n }\n } else {\n // the url might be literal content. <svg>...</svg>. This is kindof a hack where if you pass the downloader something\n // that is literal content, it will just return the content. Makes the code flow cleaner in layers above.\n complete(url);\n }\n }\n}\n","module.exports = require(\"@babel/runtime/helpers/classCallCheck\");","module.exports = require(\"@babel/runtime/helpers/createClass\");","module.exports = require(\"@splunk/ui-utils/i18n\");"],"sourceRoot":""}
1
+ {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"@babel/runtime/regenerator\"","webpack:///external \"@babel/runtime/helpers/slicedToArray\"","webpack:///./src/Downloader.ts","webpack:///external \"@babel/runtime/helpers/classCallCheck\"","webpack:///external \"@babel/runtime/helpers/createClass\"","webpack:///external \"@splunk/ui-utils/i18n\""],"names":[],"mappings":";;;;;;;QAAA;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;Q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AG,KAAR;AACH;;AAED,UAAI,KAAJ,EAAW;AACP,YAAI;AAAA,gCACoB,QAAQ,CAAC,KAAT,CAAe,GAAf,CADpB;AAAA;AAAA;AAAA,cACO,IADP,kCACc,EADd;;AAEA,cAAI,KAAK,WAAL,CAAiB,IAAjB,CAAJ,EAA4B;AACxB;AACA,iBAAK,WAAL,CAAiB,IAAjB,EAAuB,oBAAvB,CAA4C,GAA5C,EAAiD,QAAjD,EAA2D,QAA3D,EAAqE,KAArE;AACH,WAHD,MAGO;AACH;AACA,iBAAK,qCAA8B,IAA9B,iCAAyD,GAAzD,EAAL;AACH;AACJ,SATD,CASE,OAAO,CAAP,EAAU;AACR,eAAK,6CAAsC,CAAC,CAAC,OAAxC,EAAL;AACH;AACJ,OAbD,MAaO;AACH;AACA;AACA,gBAAQ,CAAC,GAAD,CAAR;AACH;AACJ;;;;;;AA9CL,6B;;;;;;;ACtIA,kE;;;;;;;ACAA,+D;;;;;;;ACAA,kD","file":"Downloader.js","sourcesContent":[" \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 = 27);\n","module.exports = require(\"@babel/runtime/regenerator\");","module.exports = require(\"@babel/runtime/helpers/slicedToArray\");","/* eslint-disable max-classes-per-file */\n/* eslint-disable class-methods-use-this */\nimport { _ } from '@splunk/ui-utils/i18n';\nimport ImageRegistry from '@splunk/visualization-context/ImageRegistry';\n\nexport interface DownloadProgress {\n bytesDownloaded: number;\n contentLength?: number;\n message: string;\n}\nexport interface IDownloader {\n downloadWithProgress(\n url: string,\n complete: (svg: string) => void,\n progress?: (p: DownloadProgress) => void,\n error?: (msg: string, error?: Error) => void\n ): void;\n}\n\nexport const b64DecodeUnicode = (base64Data: string): string => {\n // from bytestream, to percent-encoding, to original string.\n return decodeURIComponent(\n atob(base64Data)\n .split('')\n .map((c: string): string => {\n return `%${`00${c.charCodeAt(0).toString(16)}`.slice(-2)}`;\n })\n .join('')\n );\n};\n\nexport class ImageRegistryFetcher implements IDownloader {\n context: ImageRegistry;\n\n constructor(context?: ImageRegistry) {\n this.context = context;\n }\n\n async downloadWithProgress(\n url: string,\n complete: (svg: string) => void,\n progress?: (p: DownloadProgress) => void,\n error?: (msg: string, error?: Error) => void\n ): Promise<void> {\n const imageRegistry = this.context;\n if (!imageRegistry) {\n error(_('Missing Image Context'));\n }\n try {\n const imageData = await imageRegistry.getByURL(url);\n const [mime, svgBase64] = imageData.dataURI.split('base64,');\n if (mime && mime.toLowerCase().indexOf('image/svg+xml') > -1) {\n complete(b64DecodeUnicode(svgBase64));\n } else {\n error(_(`Unsupported MIME type ${mime} for url ${url}`));\n }\n } catch (e) {\n error(_(`Error retrieving ${url} from Image Registry, error was '${e.message}'`), e);\n }\n }\n}\n\nexport class URLDownloader implements IDownloader {\n downloadWithProgress(\n url: string,\n complete: (svg: string) => void,\n progress?: (p: DownloadProgress) => void,\n error?: (msg: string, error?: Error) => void\n ): void {\n // Step 1: fetch content from URL, get reader\n fetch(url)\n .then(\n async (response: Response): Promise<void> => {\n if (!response.ok) {\n const msg = `Fetch not Ok for ${url}, status was '${response.statusText}'`;\n console.warn(msg);\n error(msg);\n return;\n }\n const reader = response.body.getReader();\n\n // Step 2: get total length\n const contentLength = +response.headers.get('Content-Length');\n\n // Step 3: read the data\n let bytesDownloaded = 0; // length at the moment\n const chunks = []; // array of received binary chunks (comprises the body)\n let done = false;\n while (!done) {\n // eslint-disable-next-line no-await-in-loop\n const res = await reader.read();\n done = res.done;\n const { value } = res;\n if (value) {\n chunks.push(value);\n bytesDownloaded += value.length;\n progress({\n // call the progress callback...can enable the UI to show progress\n bytesDownloaded,\n contentLength,\n message: `Received ${bytesDownloaded} bytes of ${\n contentLength || 'unknown size'\n }`,\n });\n }\n }\n\n // Step 4: concatenate chunks into single Uint8Array\n const chunksAll = new Uint8Array(bytesDownloaded);\n let position = 0;\n // eslint-disable-next-line no-restricted-syntax\n for (const chunk of chunks) {\n chunksAll.set(chunk, position);\n position += chunk.length;\n }\n\n progress({\n bytesDownloaded,\n contentLength,\n message: 'decoding chunks',\n });\n\n // Step 5: decode into a string\n const svg = new TextDecoder('utf-8').decode(chunksAll);\n complete(svg); // show the downloaded svg back to the caller via its completion callback\n }\n )\n .catch((e: Error): void => {\n console.error(e.toString());\n error(`Fetch error for '${url}', error was '${e.toString()}'`, e); // call the supplied error handling function\n });\n }\n}\n\nexport default class Downloader {\n private downloaders = {};\n\n constructor(downloaders: { [protocol: string]: IDownloader }) {\n this.downloaders = downloaders;\n }\n\n downloadWithProgress(\n url: string,\n complete: (svg: string) => void,\n progress?: (p: DownloadProgress) => void,\n error?: (msg: string, error?: Error) => void\n ): void {\n // url is the following:\n // data:image/svg+xml;base64....\n // http://\n // https://\n // local://\n // or otherwise return errors\n\n let protocol = '';\n let isUrl = true;\n try {\n protocol = new URL(url).protocol;\n } catch (e) {\n isUrl = false;\n }\n\n if (isUrl) {\n try {\n const [type = ''] = protocol.split(':');\n if (this.downloaders[type]) {\n // data, http(s), local....\n this.downloaders[type].downloadWithProgress(url, complete, progress, error);\n } else {\n // unknown type\n error(`Unsupported URL protocol '${type}' for SVG download: ${url}`);\n }\n } catch (e) {\n error(`Unexpected error downloading SVG: ${e.message}`);\n }\n } else {\n // the url might be literal content. <svg>...</svg>. This is kindof a hack where if you pass the downloader something\n // that is literal content, it will just return the content. Makes the code flow cleaner in layers above.\n complete(url);\n }\n }\n}\n","module.exports = require(\"@babel/runtime/helpers/classCallCheck\");","module.exports = require(\"@babel/runtime/helpers/createClass\");","module.exports = require(\"@splunk/ui-utils/i18n\");"],"sourceRoot":""}
package/FileDownloader.js CHANGED
@@ -87,7 +87,7 @@ module.exports =
87
87
  /******/
88
88
  /******/
89
89
  /******/ // Load entry module and return exports
90
- /******/ return __webpack_require__(__webpack_require__.s = 45);
90
+ /******/ return __webpack_require__(__webpack_require__.s = 46);
91
91
  /******/ })
92
92
  /************************************************************************/
93
93
  /******/ ({
@@ -163,13 +163,16 @@ Object.defineProperty(exports, "__esModule", {
163
163
  value: true
164
164
  });
165
165
  exports.URLDownloader = exports.ImageRegistryFetcher = exports.b64DecodeUnicode = void 0;
166
+ /* eslint-disable max-classes-per-file */
167
+
168
+ /* eslint-disable class-methods-use-this */
166
169
 
167
170
  var i18n_1 = __webpack_require__(7);
168
171
 
169
172
  var b64DecodeUnicode = function b64DecodeUnicode(base64Data) {
170
- //from bytestream, to percent-encoding, to original string.
173
+ // from bytestream, to percent-encoding, to original string.
171
174
  return decodeURIComponent(atob(base64Data).split('').map(function (c) {
172
- return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
175
+ return "%".concat("00".concat(c.charCodeAt(0).toString(16)).slice(-2));
173
176
  }).join(''));
174
177
  };
175
178
 
@@ -293,7 +296,7 @@ var URLDownloader = /*#__PURE__*/function () {
293
296
  chunks.push(value);
294
297
  bytesDownloaded += value.length;
295
298
  progress({
296
- //call the progress callback...can enable the UI to show progress
299
+ // call the progress callback...can enable the UI to show progress
297
300
  bytesDownloaded: bytesDownloaded,
298
301
  contentLength: contentLength,
299
302
  message: "Received ".concat(bytesDownloaded, " bytes of ").concat(contentLength || 'unknown size')
@@ -306,7 +309,7 @@ var URLDownloader = /*#__PURE__*/function () {
306
309
  case 19:
307
310
  // Step 4: concatenate chunks into single Uint8Array
308
311
  chunksAll = new Uint8Array(bytesDownloaded);
309
- position = 0;
312
+ position = 0; // eslint-disable-next-line no-restricted-syntax
310
313
 
311
314
  for (_i = 0, _chunks = chunks; _i < _chunks.length; _i++) {
312
315
  chunk = _chunks[_i];
@@ -321,7 +324,7 @@ var URLDownloader = /*#__PURE__*/function () {
321
324
  }); // Step 5: decode into a string
322
325
 
323
326
  svg = new TextDecoder('utf-8').decode(chunksAll);
324
- complete(svg); //show the downloaded svg back to the caller via its completion callback
327
+ complete(svg); // show the downloaded svg back to the caller via its completion callback
325
328
 
326
329
  case 25:
327
330
  case "end":
@@ -414,7 +417,7 @@ module.exports = require("@babel/runtime/helpers/classCallCheck");
414
417
 
415
418
  /***/ }),
416
419
 
417
- /***/ 45:
420
+ /***/ 46:
418
421
  /***/ (function(module, exports, __webpack_require__) {
419
422
 
420
423
  "use strict";
@@ -463,6 +466,13 @@ var FileDownloader = /*#__PURE__*/function (_React$PureComponent) {
463
466
  value: function componentDidMount() {
464
467
  this.initiateDownload();
465
468
  }
469
+ }, {
470
+ key: "componentDidUpdate",
471
+ value: function componentDidUpdate(prevProps) {
472
+ if (this.props.url !== prevProps.url) {
473
+ this.initiateDownload();
474
+ }
475
+ }
466
476
  }, {
467
477
  key: "initiateDownload",
468
478
  value: function initiateDownload() {
@@ -475,7 +485,7 @@ var FileDownloader = /*#__PURE__*/function (_React$PureComponent) {
475
485
  return _this2.setState({
476
486
  content: content
477
487
  });
478
- }, //done downloading
488
+ }, // done downloading
479
489
  function (progress) {
480
490
  _this2.setState({
481
491
  progress: progress
@@ -486,13 +496,6 @@ var FileDownloader = /*#__PURE__*/function (_React$PureComponent) {
486
496
  });
487
497
  });
488
498
  }
489
- }, {
490
- key: "componentDidUpdate",
491
- value: function componentDidUpdate(prevProps) {
492
- if (this.props.url !== prevProps.url) {
493
- this.initiateDownload();
494
- }
495
- }
496
499
  }, {
497
500
  key: "render",
498
501
  value: function render() {
@@ -518,11 +521,13 @@ var FileDownloader = /*#__PURE__*/function (_React$PureComponent) {
518
521
 
519
522
  if (content) {
520
523
  return renderContent(content); // render prop
521
- } else if (error) {
524
+ }
525
+
526
+ if (error) {
522
527
  return renderError(error);
523
- } else {
524
- return renderProgress(progress);
525
528
  }
529
+
530
+ return renderProgress(progress);
526
531
  }
527
532
  }]);
528
533
 
@@ -1 +1 @@
1
- {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"react\"","webpack:///external \"@babel/runtime/regenerator\"","webpack:///external \"@babel/runtime/helpers/slicedToArray\"","webpack:///./src/Downloader.ts","webpack:///external \"@babel/runtime/helpers/getPrototypeOf\"","webpack:///external \"@babel/runtime/helpers/classCallCheck\"","webpack:///./src/FileDownloader.tsx","webpack:///external \"@babel/runtime/helpers/createClass\"","webpack:///external \"@splunk/ui-utils/i18n\"","webpack:///external \"@babel/runtime/helpers/inherits\"","webpack:///external \"@babel/runtime/helpers/possibleConstructorReturn\""],"names":[],"mappings":";;;;;;;QAAA;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,kC;;;;;;;ACAA,uD;;;;;;;ACAA,iE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACAA;;AAiBO,IAAM,gBAAgB,GAAG,SAAnB,gBAAmB,CAAC,UAAD,EAA+B;AAC3D;AACA,SAAO,kBAAkB,CACrB,IAAI,CAAC,UAAD,CAAJ,CACK,KADL,CACW,EADX,EAEK,GAFL,CAES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AAC,OAAR,CAAtC;AAAA,OAJnB;AAAA,8CAKE,WALF;AAAA,UAKE,WALF,sCAKgB,UAAC,GAAD;AAAA,eAA8B,iCAAM,GAAN,CAA9B;AAAA,OALhB;AAAA,wBAWE,KAAK,KAXP;AAAA,UAQE,OARF,eAQE,OARF;AAAA,6CASE,QATF;AAAA,UASE,QATF,qCASa;AAAE,eAAO,wBAAiB,GAAjB,QAAT;AAAoC,uBAAe,EAAE;AAArD,OATb;AAAA,UAUE,KAVF,eAUE,KAVF;;AAYF,UAAI,OAAJ,EAAa;AACT,eAAO,aAAa,CAAC,OAAD,CAApB,CADS,CACsB;AAClC,OAFD,MAEO,IAAI,KAAJ,EAAW;AACd,eAAO,WAAW,CAAC,KAAD,CAAlB;AACH,OAFM,MAEA;AACH,eAAO,cAAc,CAAC,QAAD,CAArB;AACH;AACJ;;;;EAtD+B,KAAK,CAAC,a;;AAA1C,wC;;;;;;;ACtCA,+D;;;;;;;ACAA,kD;;;;;;;ACAA,4D;;;;;;;ACAA,6E","file":"FileDownloader.js","sourcesContent":[" \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 = 45);\n","module.exports = require(\"react\");","module.exports = require(\"@babel/runtime/regenerator\");","module.exports = require(\"@babel/runtime/helpers/slicedToArray\");","import { _ } from '@splunk/ui-utils/i18n';\nimport ImageRegistry from '@splunk/visualization-context/ImageRegistry';\n\nexport interface DownloadProgress {\n bytesDownloaded: number;\n contentLength?: number;\n message: string;\n}\nexport interface IDownloader {\n downloadWithProgress(\n url: string,\n complete: (svg: string) => void,\n progress?: (p: DownloadProgress) => void,\n error?: (msg: string, error?: Error) => void\n ): void;\n}\n\nexport const b64DecodeUnicode = (base64Data: string): string => {\n //from bytestream, to percent-encoding, to original string.\n return decodeURIComponent(\n atob(base64Data)\n .split('')\n .map((c: string): string => {\n return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);\n })\n .join('')\n );\n};\n\nexport class ImageRegistryFetcher implements IDownloader {\n context: ImageRegistry;\n constructor(context?: ImageRegistry) {\n this.context = context;\n }\n async downloadWithProgress(\n url: string,\n complete: (svg: string) => void,\n progress?: (p: DownloadProgress) => void,\n error?: (msg: string, error?: Error) => void\n ): Promise<void> {\n const imageRegistry = this.context;\n if (!imageRegistry) {\n error(_('Missing Image Context'));\n }\n try {\n const imageData = await imageRegistry.getByURL(url);\n const [mime, svgBase64] = imageData.dataURI.split('base64,');\n if (mime && mime.toLowerCase().indexOf('image/svg+xml') > -1) {\n complete(b64DecodeUnicode(svgBase64));\n } else {\n error(_(`Unsupported MIME type ${mime} for url ${url}`));\n }\n } catch (e) {\n error(_(`Error retrieving ${url} from Image Registry, error was '${e.message}'`), e);\n }\n }\n}\n\nexport class URLDownloader implements IDownloader {\n downloadWithProgress(\n url: string,\n complete: (svg: string) => void,\n progress?: (p: DownloadProgress) => void,\n error?: (msg: string, error?: Error) => void\n ): void {\n // Step 1: fetch content from URL, get reader\n fetch(url)\n .then(\n async (response: Response): Promise<void> => {\n if (!response.ok) {\n const msg = `Fetch not Ok for ${url}, status was '${response.statusText}'`;\n console.warn(msg);\n error(msg);\n return;\n }\n const reader = response.body.getReader();\n\n // Step 2: get total length\n const contentLength = +response.headers.get('Content-Length');\n\n // Step 3: read the data\n let bytesDownloaded = 0; // length at the moment\n const chunks = []; // array of received binary chunks (comprises the body)\n let done = false;\n while (!done) {\n const res = await reader.read();\n done = res.done;\n const { value } = res;\n if (value) {\n chunks.push(value);\n bytesDownloaded += value.length;\n progress({\n //call the progress callback...can enable the UI to show progress\n bytesDownloaded,\n contentLength,\n message: `Received ${bytesDownloaded} bytes of ${\n contentLength || 'unknown size'\n }`,\n });\n }\n }\n\n // Step 4: concatenate chunks into single Uint8Array\n const chunksAll = new Uint8Array(bytesDownloaded);\n let position = 0;\n for (const chunk of chunks) {\n chunksAll.set(chunk, position);\n position += chunk.length;\n }\n\n progress({\n bytesDownloaded,\n contentLength,\n message: 'decoding chunks',\n });\n\n // Step 5: decode into a string\n const svg = new TextDecoder('utf-8').decode(chunksAll);\n complete(svg); //show the downloaded svg back to the caller via its completion callback\n }\n )\n .catch((e: Error): void => {\n console.error(e.toString());\n error(`Fetch error for '${url}', error was '${e.toString()}'`, e); // call the supplied error handling function\n });\n }\n}\n\nexport default class Downloader {\n private downloaders = {};\n constructor(downloaders: { [protocol: string]: IDownloader }) {\n this.downloaders = downloaders;\n }\n\n downloadWithProgress(\n url: string,\n complete: (svg: string) => void,\n progress?: (p: DownloadProgress) => void,\n error?: (msg: string, error?: Error) => void\n ): void {\n // url is the following:\n // data:image/svg+xml;base64....\n // http://\n // https://\n // local://\n // or otherwise return errors\n\n let protocol = '';\n let isUrl = true;\n try {\n protocol = new URL(url).protocol;\n } catch (e) {\n isUrl = false;\n }\n\n if (isUrl) {\n try {\n const [type = ''] = protocol.split(':');\n if (this.downloaders[type]) {\n // data, http(s), local....\n this.downloaders[type].downloadWithProgress(url, complete, progress, error);\n } else {\n // unknown type\n error(`Unsupported URL protocol '${type}' for SVG download: ${url}`);\n }\n } catch (e) {\n error(`Unexpected error downloading SVG: ${e.message}`);\n }\n } else {\n // the url might be literal content. <svg>...</svg>. This is kindof a hack where if you pass the downloader something\n // that is literal content, it will just return the content. Makes the code flow cleaner in layers above.\n complete(url);\n }\n }\n}\n","module.exports = require(\"@babel/runtime/helpers/getPrototypeOf\");","module.exports = require(\"@babel/runtime/helpers/classCallCheck\");","import * as React from 'react';\nimport Downloader, { IDownloader, DownloadProgress } from './Downloader';\n\n/**\n * The FileDownloader is passed a URL string, and render prop which allows a caller to control what is rendered\n * When the file is completely downloaded. This FileDownloader also displays basic text showing download progress.\n * If you want to supply your own custom renderer or progress and error you can do so as well.\n *\n */\nexport interface FileDownloaderProps {\n /**\n * The URL to download\n */\n url: string;\n /**\n * The render function that will render when the content is downloaded\n * @returns {React.Component}\n */\n renderContent: (content: string) => React.ReactElement;\n /**\n * An optional function to render progress (defaults to basic text display of progress)\n * @param {DownloadProgress} progress\n * @returns {React.Component}\n */\n renderProgress?: (progress: DownloadProgress) => React.Component;\n /**\n * An optional function to render errors (defaults to basic text display of errors)\n * @param {string} msg\n * @param {Error} error\n * @returns {React.Component}\n */\n renderError?: (msg: string, error?: Error) => React.Component;\n /**\n * A <key>:<Downloader> map for Downloader Component\n */\n protocolHandlers: { [key: string]: IDownloader };\n}\n\nexport class FileDownloader extends React.PureComponent<\n FileDownloaderProps,\n { content?: string; progress?: DownloadProgress; error?: string }\n> {\n constructor(props) {\n super(props);\n this.state = {};\n }\n componentDidMount(): void {\n this.initiateDownload();\n }\n\n initiateDownload(): void {\n this.setState({});\n const { url } = this.props;\n\n const downloader = new Downloader(this.props.protocolHandlers);\n downloader.downloadWithProgress(\n url,\n (content: string): void => this.setState({ content }), //done downloading\n (progress: DownloadProgress): void => {\n this.setState({ progress });\n },\n (msg: string): void => {\n this.setState({ error: msg });\n }\n );\n }\n\n componentDidUpdate(prevProps): void {\n if (this.props.url !== prevProps.url) {\n this.initiateDownload();\n }\n }\n\n render(): JSX.Element | React.Component {\n const {\n url,\n renderContent,\n renderProgress = (p: DownloadProgress): JSX.Element => <div>{p.message}</div>,\n renderError = (msg: string): JSX.Element => <div>{msg}</div>,\n } = this.props;\n const {\n content,\n progress = { message: `Downloading ${url}...`, bytesDownloaded: 0 },\n error,\n } = this.state;\n if (content) {\n return renderContent(content); // render prop\n } else if (error) {\n return renderError(error);\n } else {\n return renderProgress(progress);\n }\n }\n}\n","module.exports = require(\"@babel/runtime/helpers/createClass\");","module.exports = require(\"@splunk/ui-utils/i18n\");","module.exports = require(\"@babel/runtime/helpers/inherits\");","module.exports = require(\"@babel/runtime/helpers/possibleConstructorReturn\");"],"sourceRoot":""}
1
+ {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"react\"","webpack:///external \"@babel/runtime/regenerator\"","webpack:///external \"@babel/runtime/helpers/slicedToArray\"","webpack:///./src/Downloader.ts","webpack:///external \"@babel/runtime/helpers/getPrototypeOf\"","webpack:///external \"@babel/runtime/helpers/classCallCheck\"","webpack:///./src/FileDownloader.tsx","webpack:///external \"@babel/runtime/helpers/createClass\"","webpack:///external \"@splunk/ui-utils/i18n\"","webpack:///external \"@babel/runtime/helpers/inherits\"","webpack:///external \"@babel/runtime/helpers/possibleConstructorReturn\""],"names":[],"mappings":";;;;;;;QAAA;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,kC;;;;;;;ACAA,uD;;;;;;;ACAA,iE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACAA;;AACA;;AACA;;AAiBO,IAAM,gBAAgB,GAAG,SAAnB,gBAAmB,CAAC,UAAD,EAA+B;AAC3D;AACA,SAAO,kBAAkB,CAC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E,cAJF,sCAImB,UAAC,CAAD;AAAA,eAAsC,iCAAM,CAAC,CAAC,OAAR,CAAtC;AAAA,OAJnB;AAAA,8CAKE,WALF;AAAA,UAKE,WALF,sCAKgB,UAAC,GAAD;AAAA,eAA8B,iCAAM,GAAN,CAA9B;AAAA,OALhB;AAAA,wBAWE,KAAK,KAXP;AAAA,UAQE,OARF,eAQE,OARF;AAAA,6CASE,QATF;AAAA,UASE,QATF,qCASa;AAAE,eAAO,wBAAiB,GAAjB,QAAT;AAAoC,uBAAe,EAAE;AAArD,OATb;AAAA,UAUE,KAVF,eAUE,KAVF;;AAYF,UAAI,OAAJ,EAAa;AACT,eAAO,aAAa,CAAC,OAAD,CAApB,CADS,CACsB;AAClC;;AACD,UAAI,KAAJ,EAAW;AACP,eAAO,WAAW,CAAC,KAAD,CAAlB;AACH;;AACD,aAAO,cAAc,CAAC,QAAD,CAArB;AACH;;;;EAvD+B,KAAK,CAAC,a;;AAA1C,wC;;;;;;;ACtCA,+D;;;;;;;ACAA,kD;;;;;;;ACAA,4D;;;;;;;ACAA,6E","file":"FileDownloader.js","sourcesContent":[" \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 = 46);\n","module.exports = require(\"react\");","module.exports = require(\"@babel/runtime/regenerator\");","module.exports = require(\"@babel/runtime/helpers/slicedToArray\");","/* eslint-disable max-classes-per-file */\n/* eslint-disable class-methods-use-this */\nimport { _ } from '@splunk/ui-utils/i18n';\nimport ImageRegistry from '@splunk/visualization-context/ImageRegistry';\n\nexport interface DownloadProgress {\n bytesDownloaded: number;\n contentLength?: number;\n message: string;\n}\nexport interface IDownloader {\n downloadWithProgress(\n url: string,\n complete: (svg: string) => void,\n progress?: (p: DownloadProgress) => void,\n error?: (msg: string, error?: Error) => void\n ): void;\n}\n\nexport const b64DecodeUnicode = (base64Data: string): string => {\n // from bytestream, to percent-encoding, to original string.\n return decodeURIComponent(\n atob(base64Data)\n .split('')\n .map((c: string): string => {\n return `%${`00${c.charCodeAt(0).toString(16)}`.slice(-2)}`;\n })\n .join('')\n );\n};\n\nexport class ImageRegistryFetcher implements IDownloader {\n context: ImageRegistry;\n\n constructor(context?: ImageRegistry) {\n this.context = context;\n }\n\n async downloadWithProgress(\n url: string,\n complete: (svg: string) => void,\n progress?: (p: DownloadProgress) => void,\n error?: (msg: string, error?: Error) => void\n ): Promise<void> {\n const imageRegistry = this.context;\n if (!imageRegistry) {\n error(_('Missing Image Context'));\n }\n try {\n const imageData = await imageRegistry.getByURL(url);\n const [mime, svgBase64] = imageData.dataURI.split('base64,');\n if (mime && mime.toLowerCase().indexOf('image/svg+xml') > -1) {\n complete(b64DecodeUnicode(svgBase64));\n } else {\n error(_(`Unsupported MIME type ${mime} for url ${url}`));\n }\n } catch (e) {\n error(_(`Error retrieving ${url} from Image Registry, error was '${e.message}'`), e);\n }\n }\n}\n\nexport class URLDownloader implements IDownloader {\n downloadWithProgress(\n url: string,\n complete: (svg: string) => void,\n progress?: (p: DownloadProgress) => void,\n error?: (msg: string, error?: Error) => void\n ): void {\n // Step 1: fetch content from URL, get reader\n fetch(url)\n .then(\n async (response: Response): Promise<void> => {\n if (!response.ok) {\n const msg = `Fetch not Ok for ${url}, status was '${response.statusText}'`;\n console.warn(msg);\n error(msg);\n return;\n }\n const reader = response.body.getReader();\n\n // Step 2: get total length\n const contentLength = +response.headers.get('Content-Length');\n\n // Step 3: read the data\n let bytesDownloaded = 0; // length at the moment\n const chunks = []; // array of received binary chunks (comprises the body)\n let done = false;\n while (!done) {\n // eslint-disable-next-line no-await-in-loop\n const res = await reader.read();\n done = res.done;\n const { value } = res;\n if (value) {\n chunks.push(value);\n bytesDownloaded += value.length;\n progress({\n // call the progress callback...can enable the UI to show progress\n bytesDownloaded,\n contentLength,\n message: `Received ${bytesDownloaded} bytes of ${\n contentLength || 'unknown size'\n }`,\n });\n }\n }\n\n // Step 4: concatenate chunks into single Uint8Array\n const chunksAll = new Uint8Array(bytesDownloaded);\n let position = 0;\n // eslint-disable-next-line no-restricted-syntax\n for (const chunk of chunks) {\n chunksAll.set(chunk, position);\n position += chunk.length;\n }\n\n progress({\n bytesDownloaded,\n contentLength,\n message: 'decoding chunks',\n });\n\n // Step 5: decode into a string\n const svg = new TextDecoder('utf-8').decode(chunksAll);\n complete(svg); // show the downloaded svg back to the caller via its completion callback\n }\n )\n .catch((e: Error): void => {\n console.error(e.toString());\n error(`Fetch error for '${url}', error was '${e.toString()}'`, e); // call the supplied error handling function\n });\n }\n}\n\nexport default class Downloader {\n private downloaders = {};\n\n constructor(downloaders: { [protocol: string]: IDownloader }) {\n this.downloaders = downloaders;\n }\n\n downloadWithProgress(\n url: string,\n complete: (svg: string) => void,\n progress?: (p: DownloadProgress) => void,\n error?: (msg: string, error?: Error) => void\n ): void {\n // url is the following:\n // data:image/svg+xml;base64....\n // http://\n // https://\n // local://\n // or otherwise return errors\n\n let protocol = '';\n let isUrl = true;\n try {\n protocol = new URL(url).protocol;\n } catch (e) {\n isUrl = false;\n }\n\n if (isUrl) {\n try {\n const [type = ''] = protocol.split(':');\n if (this.downloaders[type]) {\n // data, http(s), local....\n this.downloaders[type].downloadWithProgress(url, complete, progress, error);\n } else {\n // unknown type\n error(`Unsupported URL protocol '${type}' for SVG download: ${url}`);\n }\n } catch (e) {\n error(`Unexpected error downloading SVG: ${e.message}`);\n }\n } else {\n // the url might be literal content. <svg>...</svg>. This is kindof a hack where if you pass the downloader something\n // that is literal content, it will just return the content. Makes the code flow cleaner in layers above.\n complete(url);\n }\n }\n}\n","module.exports = require(\"@babel/runtime/helpers/getPrototypeOf\");","module.exports = require(\"@babel/runtime/helpers/classCallCheck\");","import * as React from 'react';\nimport Downloader, { IDownloader, DownloadProgress } from './Downloader';\n\n/**\n * The FileDownloader is passed a URL string, and render prop which allows a caller to control what is rendered\n * When the file is completely downloaded. This FileDownloader also displays basic text showing download progress.\n * If you want to supply your own custom renderer or progress and error you can do so as well.\n *\n */\nexport interface FileDownloaderProps {\n /**\n * The URL to download\n */\n url: string;\n /**\n * The render function that will render when the content is downloaded\n * @returns {React.Component}\n */\n renderContent: (content: string) => React.ReactElement;\n /**\n * An optional function to render progress (defaults to basic text display of progress)\n * @param {DownloadProgress} progress\n * @returns {React.Component}\n */\n renderProgress?: (progress: DownloadProgress) => React.Component;\n /**\n * An optional function to render errors (defaults to basic text display of errors)\n * @param {string} msg\n * @param {Error} error\n * @returns {React.Component}\n */\n renderError?: (msg: string, error?: Error) => React.Component;\n /**\n * A <key>:<Downloader> map for Downloader Component\n */\n protocolHandlers: { [key: string]: IDownloader };\n}\n\nexport class FileDownloader extends React.PureComponent<\n FileDownloaderProps,\n { content?: string; progress?: DownloadProgress; error?: string }\n> {\n constructor(props: FileDownloaderProps) {\n super(props);\n this.state = {};\n }\n\n componentDidMount(): void {\n this.initiateDownload();\n }\n\n componentDidUpdate(prevProps: FileDownloaderProps): void {\n if (this.props.url !== prevProps.url) {\n this.initiateDownload();\n }\n }\n\n initiateDownload(): void {\n this.setState({});\n const { url } = this.props;\n\n const downloader = new Downloader(this.props.protocolHandlers);\n downloader.downloadWithProgress(\n url,\n (content: string): void => this.setState({ content }), // done downloading\n (progress: DownloadProgress): void => {\n this.setState({ progress });\n },\n (msg: string): void => {\n this.setState({ error: msg });\n }\n );\n }\n\n render(): JSX.Element | React.Component {\n const {\n url,\n renderContent,\n renderProgress = (p: DownloadProgress): JSX.Element => <div>{p.message}</div>,\n renderError = (msg: string): JSX.Element => <div>{msg}</div>,\n } = this.props;\n const {\n content,\n progress = { message: `Downloading ${url}...`, bytesDownloaded: 0 },\n error,\n } = this.state;\n if (content) {\n return renderContent(content); // render prop\n }\n if (error) {\n return renderError(error);\n }\n return renderProgress(progress);\n }\n}\n","module.exports = require(\"@babel/runtime/helpers/createClass\");","module.exports = require(\"@splunk/ui-utils/i18n\");","module.exports = require(\"@babel/runtime/helpers/inherits\");","module.exports = require(\"@babel/runtime/helpers/possibleConstructorReturn\");"],"sourceRoot":""}
package/Message.js CHANGED
@@ -87,7 +87,7 @@ module.exports =
87
87
  /******/
88
88
  /******/
89
89
  /******/ // Load entry module and return exports
90
- /******/ return __webpack_require__(__webpack_require__.s = 46);
90
+ /******/ return __webpack_require__(__webpack_require__.s = 47);
91
91
  /******/ })
92
92
  /************************************************************************/
93
93
  /******/ ({
@@ -209,7 +209,7 @@ module.exports = require("@splunk/react-ui/Message");
209
209
 
210
210
  /***/ }),
211
211
 
212
- /***/ 46:
212
+ /***/ 47:
213
213
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
214
214
 
215
215
  "use strict";
package/Message.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"prop-types\"","webpack:///external \"react\"","webpack:///external \"@babel/runtime/helpers/taggedTemplateLiteral\"","webpack:///external \"styled-components\"","webpack:///./src/style.js","webpack:///external \"lodash/isNumber\"","webpack:///external \"@splunk/react-ui/Message\"","webpack:///./src/Message.jsx"],"names":["toPx","defaultNumber","isNumber","number","toDimension","width","height","css","arrayToCSSProp","vals","Array","toMargin","margins","toPadding","paddings","MessageContainer","styled","p","Message","level","message","maxWidth","T","React"],"mappings":";;;;;;;QAAA;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,k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;AACA;AACIhB,QAAM,EAAEgB,iDAAC,CAADA,UAAY,CAACA,iDAAC,CAAF,QAAWA,iDAAC,CARhB,MAQI,CAAZA,CARQ;;AAShB;AACJ;AACA;AACIF,SAAO,EAAEE,iDAAC,CAZM;;AAahB;AACJ;AACA;AACIH,OAAK,EAAEG,iDAAC,CAADA,MAAQ,oBAARA,OAAQ,CAARA;AAhBS,CAApBJ;AAmBAA,OAAO,CAAPA,eAAuB;AACnBC,OAAK,EADc;AAEnBC,SAAO,EAAE;AAFU,CAAvBF;AAIeK,wHAAK,CAALA,KAAf,OAAeA,CAAf,E","file":"Message.js","sourcesContent":[" \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 = 46);\n","module.exports = require(\"prop-types\");","module.exports = require(\"react\");","module.exports = require(\"@babel/runtime/helpers/taggedTemplateLiteral\");","module.exports = require(\"styled-components\");","import isNumber from 'lodash/isNumber';\n\n/**\n * convert number to px\n * @param {*} number\n */\nexport const toPx = (number, defaultNumber = 0) =>\n isNumber(number) ? `${number}px` : number || toPx(defaultNumber);\n\n/**\n * generate width/height css properties\n * @param {*} param0\n */\nexport const toDimension = ({ width, height }) => {\n let css = '';\n if (width) {\n css = `width: ${toPx(width)};`;\n }\n if (height) {\n // only add a linebreak if width was also set\n css = `${css}${width ? '\\n' : ''}height: ${toPx(height)};`;\n }\n return css;\n};\n\n/**\n * generate margin css property\n */\nexport const arrayToCSSProp = (prop, vals = [0, 0, 0, 0]) => {\n if (Array.isArray(vals)) {\n return `\n ${prop}: ${toPx(vals[0])} ${toPx(vals[1])} ${toPx(vals[2])} ${toPx(vals[3])};\n `;\n }\n\n return `${prop}: ${toPx(vals)};`;\n};\n\n/**\n * generate margin css property\n */\nexport const toMargin = (margins = [0, 0, 0, 0]) => arrayToCSSProp('margin', margins);\n\n/**\n * generate padding css property\n */\nexport const toPadding = (paddings = [0, 0, 0, 0]) => arrayToCSSProp('padding', paddings);\n","module.exports = require(\"lodash/isNumber\");","module.exports = require(\"@splunk/react-ui/Message\");","import React from 'react';\nimport T from 'prop-types';\nimport styled from 'styled-components';\nimport SplunkUIMessage from '@splunk/react-ui/Message';\nimport { toDimension } from './style';\n\nconst MessageContainer = styled.div`\n overflow: hidden;\n display: flex;\n justify-content: center;\n align-items: center;\n ${p => toDimension({ width: p.width, height: p.height })};\n`;\n\n/**\n * A component that display message\n *\n */\nconst Message = ({ width, height, level, message }) => (\n <MessageContainer width={width} height={height} data-test=\"visualization-message\">\n <SplunkUIMessage type={level} style={{ maxWidth: '100%' }}>\n {message}\n </SplunkUIMessage>\n </MessageContainer>\n);\n\nMessage.propTypes = {\n /**\n * width in pixel or string, defaults to 100%\n */\n width: T.oneOfType([T.string, T.number]),\n /**\n * height in pixel or string\n */\n height: T.oneOfType([T.string, T.number]),\n /**\n * message text\n */\n message: T.string,\n /**\n * message level\n */\n level: T.oneOf(['info', 'warning', 'error']),\n};\n\nMessage.defaultProps = {\n level: 'info',\n message: '',\n};\nexport default React.memo(Message);\n"],"sourceRoot":""}
1
+ {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"prop-types\"","webpack:///external \"react\"","webpack:///external \"@babel/runtime/helpers/taggedTemplateLiteral\"","webpack:///external \"styled-components\"","webpack:///./src/style.js","webpack:///external \"lodash/isNumber\"","webpack:///external \"@splunk/react-ui/Message\"","webpack:///./src/Message.jsx"],"names":["toPx","defaultNumber","isNumber","number","toDimension","width","height","css","arrayToCSSProp","vals","Array","toMargin","margins","toPadding","paddings","MessageContainer","styled","p","Message","level","message","maxWidth","T","React"],"mappings":";;;;;;;QAAA;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,uC;;;;;;;ACAA,kC;;;;;;;ACAA,yE;;;;;;;ACAA,8C;;;;;;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA;AACA;AACA;AACA;;AACO,IAAMA,IAAI,GAAG,SAAPA,IAAO;AAAA,MAASC,aAAT;AAAA,SAChBC,sDAAQ,CAARA,MAAQ,CAARA,6BAAmCC,MAAM,IAAIH,IAAI,CADjC,aACiC,CADjC;AAAb;AAGP;AACA;AACA;AACA;;AACO,IAAMI,WAAW,GAAG,SAAdA,WAAc,OAAuB;AAAA,MAApBC,KAAoB,QAApBA,KAAoB;AAAA,MAAbC,MAAa,QAAbA,MAAa;AAC9C,MAAIC,GAAG,GAAP;;AACA,aAAW;AACPA,OAAG,oBAAaP,IAAI,CAAjB,KAAiB,CAAjB,EAAHO,GAAG,CAAHA;AACH;;AACD,cAAY;AACR;AACAA,OAAG,yBAAYF,KAAK,UAAjB,uBAAwCL,IAAI,CAA5C,MAA4C,CAA5C,EAAHO,GAAG,CAAHA;AACH;;AACD;AATG;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,kBACI;AAAiB,QAAI,EAArB;AAA8B,SAAK,EAAE;AAAEC,cAAQ,EAAE;AAAZ;AAArC,KAFQ,OAER,CADJ,CADY;AAAhB;;AAQAH,OAAO,CAAPA,YAAoB;AAChB;AACJ;AACA;AACIb,OAAK,EAAEiB,iDAAC,CAADA,UAAY,CAACA,iDAAC,CAAF,QAAWA,iDAAC,CAJf,MAIG,CAAZA,CAJS;;AAKhB;AACJ;AACA;AACIhB,QAAM,EAAEgB,iDAAC,CAADA,UAAY,CAACA,iDAAC,CAAF,QAAWA,iDAAC,CARhB,MAQI,CAAZA,CARQ;;AAShB;AACJ;AACA;AACIF,SAAO,EAAEE,iDAAC,CAZM;;AAahB;AACJ;AACA;AACIH,OAAK,EAAEG,iDAAC,CAADA,MAAQ,oBAARA,OAAQ,CAARA;AAhBS,CAApBJ;AAmBAA,OAAO,CAAPA,eAAuB;AACnBC,OAAK,EADc;AAEnBC,SAAO,EAAE;AAFU,CAAvBF;AAIeK,wHAAK,CAALA,KAAf,OAAeA,CAAf,E","file":"Message.js","sourcesContent":[" \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 = 47);\n","module.exports = require(\"prop-types\");","module.exports = require(\"react\");","module.exports = require(\"@babel/runtime/helpers/taggedTemplateLiteral\");","module.exports = require(\"styled-components\");","import isNumber from 'lodash/isNumber';\n\n/**\n * convert number to px\n * @param {*} number\n */\nexport const toPx = (number, defaultNumber = 0) =>\n isNumber(number) ? `${number}px` : number || toPx(defaultNumber);\n\n/**\n * generate width/height css properties\n * @param {*} param0\n */\nexport const toDimension = ({ width, height }) => {\n let css = '';\n if (width) {\n css = `width: ${toPx(width)};`;\n }\n if (height) {\n // only add a linebreak if width was also set\n css = `${css}${width ? '\\n' : ''}height: ${toPx(height)};`;\n }\n return css;\n};\n\n/**\n * generate margin css property\n */\nexport const arrayToCSSProp = (prop, vals = [0, 0, 0, 0]) => {\n if (Array.isArray(vals)) {\n return `\n ${prop}: ${toPx(vals[0])} ${toPx(vals[1])} ${toPx(vals[2])} ${toPx(vals[3])};\n `;\n }\n\n return `${prop}: ${toPx(vals)};`;\n};\n\n/**\n * generate margin css property\n */\nexport const toMargin = (margins = [0, 0, 0, 0]) => arrayToCSSProp('margin', margins);\n\n/**\n * generate padding css property\n */\nexport const toPadding = (paddings = [0, 0, 0, 0]) => arrayToCSSProp('padding', paddings);\n","module.exports = require(\"lodash/isNumber\");","module.exports = require(\"@splunk/react-ui/Message\");","import React from 'react';\nimport T from 'prop-types';\nimport styled from 'styled-components';\nimport SplunkUIMessage from '@splunk/react-ui/Message';\nimport { toDimension } from './style';\n\nconst MessageContainer = styled.div`\n overflow: hidden;\n display: flex;\n justify-content: center;\n align-items: center;\n ${p => toDimension({ width: p.width, height: p.height })};\n`;\n\n/**\n * A component that display message\n *\n */\nconst Message = ({ width, height, level, message }) => (\n <MessageContainer width={width} height={height} data-test=\"visualization-message\">\n <SplunkUIMessage type={level} style={{ maxWidth: '100%' }}>\n {message}\n </SplunkUIMessage>\n </MessageContainer>\n);\n\nMessage.propTypes = {\n /**\n * width in pixel or string, defaults to 100%\n */\n width: T.oneOfType([T.string, T.number]),\n /**\n * height in pixel or string\n */\n height: T.oneOfType([T.string, T.number]),\n /**\n * message text\n */\n message: T.string,\n /**\n * message level\n */\n level: T.oneOf(['info', 'warning', 'error']),\n};\n\nMessage.defaultProps = {\n level: 'info',\n message: '',\n};\nexport default React.memo(Message);\n"],"sourceRoot":""}
package/RemoteIcon.js CHANGED
@@ -87,7 +87,7 @@ module.exports =
87
87
  /******/
88
88
  /******/
89
89
  /******/ // Load entry module and return exports
90
- /******/ return __webpack_require__(__webpack_require__.s = 47);
90
+ /******/ return __webpack_require__(__webpack_require__.s = 48);
91
91
  /******/ })
92
92
  /************************************************************************/
93
93
  /******/ ([
@@ -252,13 +252,13 @@ module.exports = require("lodash/isNumber");
252
252
 
253
253
  /***/ }),
254
254
  /* 17 */,
255
- /* 18 */
255
+ /* 18 */,
256
+ /* 19 */
256
257
  /***/ (function(module, exports) {
257
258
 
258
259
  module.exports = require("@babel/runtime/helpers/toConsumableArray");
259
260
 
260
261
  /***/ }),
261
- /* 19 */,
262
262
  /* 20 */
263
263
  /***/ (function(module, exports) {
264
264
 
@@ -360,7 +360,7 @@ var b64EncodeUnicode = function b64EncodeUnicode(str) {
360
360
  "use strict";
361
361
  __webpack_require__.r(__webpack_exports__);
362
362
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "logfmt", function() { return logfmt; });
363
- /* harmony import */ var _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(18);
363
+ /* harmony import */ var _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(19);
364
364
  /* harmony import */ var _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0__);
365
365
 
366
366
  var hasWindowConsole = ('console' in window);
@@ -462,7 +462,8 @@ module.exports = require("@splunk/visualization-context/IconContext");
462
462
  /* 44 */,
463
463
  /* 45 */,
464
464
  /* 46 */,
465
- /* 47 */
465
+ /* 47 */,
466
+ /* 48 */
466
467
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
467
468
 
468
469
  "use strict";
package/RemoteIcon.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"prop-types\"","webpack:///external \"react\"","webpack:///external \"@babel/runtime/helpers/defineProperty\"","webpack:///external \"@babel/runtime/helpers/getPrototypeOf\"","webpack:///external \"@babel/runtime/helpers/classCallCheck\"","webpack:///external \"@babel/runtime/helpers/createClass\"","webpack:///external \"@splunk/ui-utils/i18n\"","webpack:///external \"@babel/runtime/helpers/inherits\"","webpack:///external \"@babel/runtime/helpers/possibleConstructorReturn\"","webpack:///external \"@babel/runtime/regenerator\"","webpack:///external \"@babel/runtime/helpers/slicedToArray\"","webpack:///external \"@babel/runtime/helpers/taggedTemplateLiteral\"","webpack:///external \"styled-components\"","webpack:///./src/style.js","webpack:///external \"lodash/isNumber\"","webpack:///external \"@babel/runtime/helpers/toConsumableArray\"","webpack:///external \"@babel/runtime/helpers/asyncToGenerator\"","webpack:///./src/iconUtils.js","webpack:///./src/console.js","webpack:///external \"xmlserializer\"","webpack:///external \"@splunk/visualization-context/IconContext\"","webpack:///./src/RemoteIcon.jsx"],"names":["toPx","defaultNumber","isNumber","number","toDimension","width","height","css","arrayToCSSProp","vals","Array","toMargin","margins","toPadding","paddings","isRemoteIcon","icon","isDataURI","shouldChangeFill","fillAttr","fillStyle","strokeAttr","strokeStyle","noneFillAttr","noneFillStyle","noFillHasStroke","shouldChangeStroke","noneStrokeAttr","noneStrokeStyle","hasFill","noStroke","b64EncodeUnicode","btoa","String","hasWindowConsole","hasConsoleMethod","window","noop","console","log","debug","info","warn","error","group","groupCollapsed","groupEnd","logWithDetails","lines","values","strings","IconContainer","styled","props","ColoredIcon","RemoteIcon","iconDataURI","prevProps","getIconDataURI","iconRegistry","_","src","type","fetch","response","parser","xmlDoc","svg","children","i","child","svgStr","xmlserializer","opacity","onIconClick","PureComponent","IconContext","iconURL","T","color","func"],"mappings":";;;;;;;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;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con.js","sourcesContent":[" \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 = 47);\n","module.exports = require(\"prop-types\");","module.exports = require(\"react\");","module.exports = require(\"@babel/runtime/helpers/defineProperty\");","module.exports = require(\"@babel/runtime/helpers/getPrototypeOf\");","module.exports = require(\"@babel/runtime/helpers/classCallCheck\");","module.exports = require(\"@babel/runtime/helpers/createClass\");","module.exports = require(\"@splunk/ui-utils/i18n\");","module.exports = require(\"@babel/runtime/helpers/inherits\");","module.exports = require(\"@babel/runtime/helpers/possibleConstructorReturn\");","module.exports = require(\"@babel/runtime/regenerator\");","module.exports = require(\"@babel/runtime/helpers/slicedToArray\");","module.exports = require(\"@babel/runtime/helpers/taggedTemplateLiteral\");","module.exports = require(\"styled-components\");","import isNumber from 'lodash/isNumber';\n\n/**\n * convert number to px\n * @param {*} number\n */\nexport const toPx = (number, defaultNumber = 0) =>\n isNumber(number) ? `${number}px` : number || toPx(defaultNumber);\n\n/**\n * generate width/height css properties\n * @param {*} param0\n */\nexport const toDimension = ({ width, height }) => {\n let css = '';\n if (width) {\n css = `width: ${toPx(width)};`;\n }\n if (height) {\n // only add a linebreak if width was also set\n css = `${css}${width ? '\\n' : ''}height: ${toPx(height)};`;\n }\n return css;\n};\n\n/**\n * generate margin css property\n */\nexport const arrayToCSSProp = (prop, vals = [0, 0, 0, 0]) => {\n if (Array.isArray(vals)) {\n return `\n ${prop}: ${toPx(vals[0])} ${toPx(vals[1])} ${toPx(vals[2])} ${toPx(vals[3])};\n `;\n }\n\n return `${prop}: ${toPx(vals)};`;\n};\n\n/**\n * generate margin css property\n */\nexport const toMargin = (margins = [0, 0, 0, 0]) => arrayToCSSProp('margin', margins);\n\n/**\n * generate padding css property\n */\nexport const toPadding = (paddings = [0, 0, 0, 0]) => arrayToCSSProp('padding', paddings);\n","module.exports = require(\"lodash/isNumber\");","module.exports = require(\"@babel/runtime/helpers/toConsumableArray\");","module.exports = require(\"@babel/runtime/helpers/asyncToGenerator\");","/**\n * check if an icon is considered as remote icon\n * @param {*} icon\n */\nexport const isRemoteIcon = (icon = '') => icon.indexOf('://') > -1;\n\n/**\n * check if an icon is a dataURI\n * @param {*} icon\n */\nexport const isDataURI = (icon = '') => icon.startsWith('data:image/svg+xml;base64');\n\n/*\n * check whether need update fill for svg children elements\n * @params {Object} style\n * @params {String} style.fillAttr <path fill=\"red\" .../>\n * @params {String} style.fillStyle. <path style=\"fill: red;\" />\n * @params {String} style.strokeAttr. <path stroke=\"red\" .../>\n * @params {String} style.strokeStyle <path style=\"stroke: red;\" .../>\n * @returns {Boolean} true means need\n * remove fill style and change the fill attribute <path fill=\"currentColor\" />\n */\nexport const shouldChangeFill = ({ fillAttr, fillStyle, strokeAttr, strokeStyle }) => {\n const noneFillAttr = !!fillAttr && (fillAttr === 'none' || fillAttr === 'transparent');\n const noneFillStyle = !!fillStyle && (fillStyle === 'none' || fillStyle === 'transparent');\n const noFillHasStroke = !fillAttr && !fillStyle && (!!strokeAttr || !!strokeStyle);\n return !(noneFillAttr || noneFillStyle || noFillHasStroke);\n};\n\n/*\n * check whether need update stroke for svg children elements\n * @params {Object} style\n * @params {String} style.fillAttr <path fill=\"red\" .../>\n * @params {String} style.fillStyle. <path style=\"fill: red;\" />\n * @params {String} style.strokeAttr. <path stroke=\"red\" .../>\n * @params {String} style.strokeStyle <path style=\"stroke: red;\" .../>\n * @returns {Boolean} true means need\n * remove stroke style and change the stroke attribute <path stroke=\"currentColor\" />\n */\nexport const shouldChangeStroke = ({ fillAttr, fillStyle, strokeAttr, strokeStyle }) => {\n const noneStrokeAttr = !!strokeAttr && (strokeAttr === 'none' || strokeAttr === 'transparent');\n const noneStrokeStyle = !!strokeStyle && (strokeStyle === 'none' || strokeStyle === 'transparent');\n const hasFill = !!fillAttr || !!fillStyle;\n const noStroke = !strokeAttr && !strokeStyle;\n return !(noneStrokeAttr || noneStrokeStyle || hasFill || noStroke);\n};\n\n/*\n * base64 encoding\n * @param {String} str\n * @return {Base64} string using based-64 encoding\n */\nexport const b64EncodeUnicode = str =>\n // first we use encodeURIComponent to get percent-encoded UTF-8,\n // then we convert the percent encodings into raw bytes which\n // can be fed into btoa.\n btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, (match, p1) => String.fromCharCode(`0x${p1}`)));\n","const hasWindowConsole = 'console' in window;\nconst hasConsoleMethod = method => hasWindowConsole && typeof window.console[method] === 'function';\nconst noop = () => {};\n\nconst console = {\n log: hasConsoleMethod('log') ? (...args) => window.console.log(...args) : noop,\n debug: hasConsoleMethod('debug') ? (...args) => window.console.debug(...args) : noop,\n info: hasConsoleMethod('info') ? (...args) => window.console.info(...args) : noop,\n warn: hasConsoleMethod('warn') ? (...args) => window.console.warn(...args) : noop,\n error: hasConsoleMethod('error') ? (...args) => window.console.error(...args) : noop,\n group: hasConsoleMethod('group') ? (...args) => window.console.group(...args) : noop,\n groupCollapsed: hasConsoleMethod('groupCollapsed')\n ? (...args) => window.console.groupCollapsed(...args)\n : noop,\n groupEnd: hasConsoleMethod('groupEnd') ? (...args) => window.console.groupEnd(...args) : noop,\n\n logWithDetails(message, lines) {\n console.groupCollapsed(message);\n lines.forEach(line => (Array.isArray(line) ? console.log(...line) : console.log(line)));\n console.groupEnd();\n },\n};\n\nexport default console;\n\nexport function logfmt(strings, ...values) {\n return [strings.join('%o'), ...(values || [])];\n}\n","module.exports = require(\"xmlserializer\");","module.exports = require(\"@splunk/visualization-context/IconContext\");","/* eslint-disable class-methods-use-this */\nimport React, { PureComponent } from 'react';\nimport T from 'prop-types';\nimport styled from 'styled-components';\nimport xmlserializer from 'xmlserializer';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport IconContext from '@splunk/visualization-context/IconContext';\nimport { toDimension } from './style';\nimport { shouldChangeFill, shouldChangeStroke, b64EncodeUnicode } from './iconUtils';\nimport console from './console';\n\nconst IconContainer = styled.div`\n ${props => toDimension({ width: props.width, height: props.height })};\n margin: auto;\n cursor: ${props => (props.onClick ? 'pointer' : 'inherit')};\n`;\nconst ColoredIcon = styled.img`\n ${props => toDimension({ width: props.width, height: props.height })};\n opacity: ${props => props.opacity || 1.0};\n`;\n\nclass RemoteIcon extends PureComponent {\n static contextType = IconContext;\n\n static propTypes = {\n iconURL: T.string,\n color: T.string,\n width: T.number,\n height: T.number,\n opacity: T.number,\n onIconClick: T.func,\n };\n\n static defaultProps = {\n width: 100,\n height: 100,\n opacity: 1.0,\n };\n\n static BASIC_SHAPES = ['path', 'rect', 'circle', 'ellipse', 'line', 'polyline', 'polygon'];\n\n constructor(props) {\n super(props);\n this.state = { iconDataURI: null };\n }\n\n // eslint-disable-next-line camelcase\n UNSAFE_componentWillMount() {\n this.getIcon(this.props.iconURL, this.props.color);\n }\n\n componentDidUpdate(prevProps) {\n if (prevProps.iconURL !== this.props.iconURL || prevProps.color !== this.props.color) {\n this.getIcon(this.props.iconURL, this.props.color);\n }\n }\n\n /**\n * Check if the iconURL is a registry URL/dataURI/direct URL and fetch from the registry when required\n * @param {String} iconURL\n * @param {String} color\n */\n async getIcon(iconURL, color) {\n const getIconDataURI = async () => {\n if (this.isRegistryURL(iconURL)) {\n const iconRegistry = this.context;\n if (iconRegistry) {\n try {\n const icon = await iconRegistry.getByURL(iconURL);\n return icon.dataURI;\n } catch (error) {\n console.error(_(error));\n }\n }\n } else {\n return iconURL;\n }\n return null;\n };\n\n const iconDataURI = await getIconDataURI();\n\n if (color) {\n this.colorIcon(iconDataURI, color);\n } else {\n this.setState({ iconDataURI });\n }\n }\n\n /**\n * check if icon is a registry url\n * @param {String} src\n */\n isRegistryURL(src = '') {\n const [type] = src.split('://');\n return type !== 'http' && type !== 'https' && !src.startsWith('data:image/svg+xml;base64');\n }\n\n /*\n * Color the icon:\n * parse svg elements from the dataURI, change color style of svg, and change fill/stroke attribute/style of each svg basic shapes\n * in the svg element to currentColor. At the end, convert the modified svg back to dataURI string.\n *\n * Limitation:\n * if the svg is created with multiple pathes with different fill attributes, this method would\n * convert all pathes' fill attribute to the color prop. It may change the view of the svg icon.\n *\n * @method colorIcon\n * @params {DataURI} dataURI\n * @params {String} color e.g. 'red' || '#ffffff'\n */\n colorIcon(dataURI, color) {\n fetch(dataURI)\n .then(response => response.text())\n .then(text => {\n const parser = new DOMParser();\n const xmlDoc = parser.parseFromString(text, 'text/xml');\n const svg = xmlDoc.getElementsByTagName('svg')[0];\n const children = svg.querySelectorAll('*');\n svg.style.color = color;\n\n // Todo: need move this to IconRegistry after figure out the jest issue with XMLSerializer\n for (let i = 0; i < children.length; i += 1) {\n const child = children[i];\n\n if (RemoteIcon.BASIC_SHAPES.includes(child.tagName)) {\n const fillAttr = child.getAttribute('fill');\n const fillStyle = child.style && child.style.fill;\n const strokeAttr = child.getAttribute('stroke');\n const strokeStyle = child.style && child.style.stroke;\n\n if (shouldChangeFill({ fillAttr, fillStyle, strokeAttr, strokeStyle })) {\n child.style.fill = '';\n child.setAttribute('fill', 'currentColor');\n }\n\n if (shouldChangeStroke({ fillAttr, fillStyle, strokeAttr, strokeStyle })) {\n child.style.stroke = '';\n child.setAttribute('stroke', 'currentColor');\n }\n }\n }\n\n const svgStr = b64EncodeUnicode(xmlserializer.serializeToString(svg));\n const iconDataURI = `data:image/svg+xml;base64,${svgStr}`;\n this.setState({ iconDataURI });\n })\n .catch(() => {\n console.error(_('The icon cannot be colored properly.'));\n });\n }\n\n render() {\n const { iconDataURI } = this.state;\n const { width, height, opacity, onIconClick } = this.props;\n\n if (!iconDataURI) {\n return null;\n }\n return (\n <IconContainer width={width} height={height} onClick={onIconClick}>\n <ColoredIcon\n src={iconDataURI}\n alt=\"Remote Icon\"\n width={width}\n height={height}\n opacity={opacity}\n referrerPolicy=\"no-referrer\"\n />\n </IconContainer>\n );\n }\n}\n\nexport default RemoteIcon;\n"],"sourceRoot":""}
1
+ {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"prop-types\"","webpack:///external \"react\"","webpack:///external \"@babel/runtime/helpers/defineProperty\"","webpack:///external \"@babel/runtime/helpers/getPrototypeOf\"","webpack:///external \"@babel/runtime/helpers/classCallCheck\"","webpack:///external \"@babel/runtime/helpers/createClass\"","webpack:///external \"@splunk/ui-utils/i18n\"","webpack:///external \"@babel/runtime/helpers/inherits\"","webpack:///external \"@babel/runtime/helpers/possibleConstructorReturn\"","webpack:///external \"@babel/runtime/regenerator\"","webpack:///external \"@babel/runtime/helpers/slicedToArray\"","webpack:///external \"@babel/runtime/helpers/taggedTemplateLiteral\"","webpack:///external \"styled-components\"","webpack:///./src/style.js","webpack:///external \"lodash/isNumber\"","webpack:///external \"@babel/runtime/helpers/toConsumableArray\"","webpack:///external \"@babel/runtime/helpers/asyncToGenerator\"","webpack:///./src/iconUtils.js","webpack:///./src/console.js","webpack:///external \"xmlserializer\"","webpack:///external \"@splunk/visualization-context/IconContext\"","webpack:///./src/RemoteIcon.jsx"],"names":["toPx","defaultNumber","isNumber","number","toDimension","width","height","css","arrayToCSSProp","vals","Array","toMargin","margins","toPadding","paddings","isRemoteIcon","icon","isDataURI","shouldChangeFill","fillAttr","fillStyle","strokeAttr","strokeStyle","noneFillAttr","noneFillStyle","noFillHasStroke","shouldChangeStroke","noneStrokeAttr","noneStrokeStyle","hasFill","noStroke","b64EncodeUnicode","btoa","String","hasWindowConsole","hasConsoleMethod","window","noop","console","log","debug","info","warn","error","group","groupCollapsed","groupEnd","logWithDetails","lines","values","strings","IconContainer","styled","props","ColoredIcon","RemoteIcon","iconDataURI","prevProps","getIconDataURI","iconRegistry","_","src","type","fetch","response","parser","xmlDoc","svg","children","i","child","svgStr","xmlserializer","opacity","onIconClick","PureComponent","IconContext","iconURL","T","color","func"],"mappings":";;;;;;;QAAA;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,uC;;;;;;ACAA,kC;;;;;;ACAA,kE;;;;;;ACAA,kE;;;;;;ACAA,kE;;;;;;ACAA,+D;;;;;;;ACAA,kD;;;;;;ACAA,4D;;;;;;ACAA,6E;;;;;;ACAA,uD;;;;;;ACAA,iE;;;;;;ACAA,yE;;;;;;ACAA,8C;;;;;;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA;AACA;AACA;AACA;;AACO,IAAMA,IAAI,GAAG,SAAPA,IAAO;AAAA,MAASC,aAAT;AAAA,SAChBC,sDAAQ,CAARA,MAAQ,CAARA,6BAAmCC,MAAM,IAAIH,IAAI,CADjC,aACiC,CADjC;AAAb;AAGP;AACA;AACA;AACA;;AACO,IAAMI,WAAW,GAAG,SAAdA,WAAc,OAAuB;AAAA,MAApBC,KAAoB,QAApBA,KAAoB;AAAA,MAAbC,MAAa,QAAbA,MAAa;AAC9C,MAAIC,GAAG,GAAP;;AACA,aAAW;AACPA,OAAG,oBAAaP,IAAI,CA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M;AAKfL,SAAO,EAAEK,kDAAC,CALK;AAMfJ,aAAW,EAAEI,kDAAC,CAACE;AANA,C;;6EAHjBzB,U,kBAYoB;AAClBlD,OAAK,EADa;AAElBC,QAAM,EAFY;AAGlBmE,SAAO,EAAE;AAHS,C;;6EAZpBlB,U,kBAkBoB,oE;;AAuI1B,2E","file":"RemoteIcon.js","sourcesContent":[" \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 = 48);\n","module.exports = require(\"prop-types\");","module.exports = require(\"react\");","module.exports = require(\"@babel/runtime/helpers/defineProperty\");","module.exports = require(\"@babel/runtime/helpers/getPrototypeOf\");","module.exports = require(\"@babel/runtime/helpers/classCallCheck\");","module.exports = require(\"@babel/runtime/helpers/createClass\");","module.exports = require(\"@splunk/ui-utils/i18n\");","module.exports = require(\"@babel/runtime/helpers/inherits\");","module.exports = require(\"@babel/runtime/helpers/possibleConstructorReturn\");","module.exports = require(\"@babel/runtime/regenerator\");","module.exports = require(\"@babel/runtime/helpers/slicedToArray\");","module.exports = require(\"@babel/runtime/helpers/taggedTemplateLiteral\");","module.exports = require(\"styled-components\");","import isNumber from 'lodash/isNumber';\n\n/**\n * convert number to px\n * @param {*} number\n */\nexport const toPx = (number, defaultNumber = 0) =>\n isNumber(number) ? `${number}px` : number || toPx(defaultNumber);\n\n/**\n * generate width/height css properties\n * @param {*} param0\n */\nexport const toDimension = ({ width, height }) => {\n let css = '';\n if (width) {\n css = `width: ${toPx(width)};`;\n }\n if (height) {\n // only add a linebreak if width was also set\n css = `${css}${width ? '\\n' : ''}height: ${toPx(height)};`;\n }\n return css;\n};\n\n/**\n * generate margin css property\n */\nexport const arrayToCSSProp = (prop, vals = [0, 0, 0, 0]) => {\n if (Array.isArray(vals)) {\n return `\n ${prop}: ${toPx(vals[0])} ${toPx(vals[1])} ${toPx(vals[2])} ${toPx(vals[3])};\n `;\n }\n\n return `${prop}: ${toPx(vals)};`;\n};\n\n/**\n * generate margin css property\n */\nexport const toMargin = (margins = [0, 0, 0, 0]) => arrayToCSSProp('margin', margins);\n\n/**\n * generate padding css property\n */\nexport const toPadding = (paddings = [0, 0, 0, 0]) => arrayToCSSProp('padding', paddings);\n","module.exports = require(\"lodash/isNumber\");","module.exports = require(\"@babel/runtime/helpers/toConsumableArray\");","module.exports = require(\"@babel/runtime/helpers/asyncToGenerator\");","/**\n * check if an icon is considered as remote icon\n * @param {*} icon\n */\nexport const isRemoteIcon = (icon = '') => icon.indexOf('://') > -1;\n\n/**\n * check if an icon is a dataURI\n * @param {*} icon\n */\nexport const isDataURI = (icon = '') => icon.startsWith('data:image/svg+xml;base64');\n\n/*\n * check whether need update fill for svg children elements\n * @params {Object} style\n * @params {String} style.fillAttr <path fill=\"red\" .../>\n * @params {String} style.fillStyle. <path style=\"fill: red;\" />\n * @params {String} style.strokeAttr. <path stroke=\"red\" .../>\n * @params {String} style.strokeStyle <path style=\"stroke: red;\" .../>\n * @returns {Boolean} true means need\n * remove fill style and change the fill attribute <path fill=\"currentColor\" />\n */\nexport const shouldChangeFill = ({ fillAttr, fillStyle, strokeAttr, strokeStyle }) => {\n const noneFillAttr = !!fillAttr && (fillAttr === 'none' || fillAttr === 'transparent');\n const noneFillStyle = !!fillStyle && (fillStyle === 'none' || fillStyle === 'transparent');\n const noFillHasStroke = !fillAttr && !fillStyle && (!!strokeAttr || !!strokeStyle);\n return !(noneFillAttr || noneFillStyle || noFillHasStroke);\n};\n\n/*\n * check whether need update stroke for svg children elements\n * @params {Object} style\n * @params {String} style.fillAttr <path fill=\"red\" .../>\n * @params {String} style.fillStyle. <path style=\"fill: red;\" />\n * @params {String} style.strokeAttr. <path stroke=\"red\" .../>\n * @params {String} style.strokeStyle <path style=\"stroke: red;\" .../>\n * @returns {Boolean} true means need\n * remove stroke style and change the stroke attribute <path stroke=\"currentColor\" />\n */\nexport const shouldChangeStroke = ({ fillAttr, fillStyle, strokeAttr, strokeStyle }) => {\n const noneStrokeAttr = !!strokeAttr && (strokeAttr === 'none' || strokeAttr === 'transparent');\n const noneStrokeStyle = !!strokeStyle && (strokeStyle === 'none' || strokeStyle === 'transparent');\n const hasFill = !!fillAttr || !!fillStyle;\n const noStroke = !strokeAttr && !strokeStyle;\n return !(noneStrokeAttr || noneStrokeStyle || hasFill || noStroke);\n};\n\n/*\n * base64 encoding\n * @param {String} str\n * @return {Base64} string using based-64 encoding\n */\nexport const b64EncodeUnicode = str =>\n // first we use encodeURIComponent to get percent-encoded UTF-8,\n // then we convert the percent encodings into raw bytes which\n // can be fed into btoa.\n btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, (match, p1) => String.fromCharCode(`0x${p1}`)));\n","const hasWindowConsole = 'console' in window;\nconst hasConsoleMethod = method => hasWindowConsole && typeof window.console[method] === 'function';\nconst noop = () => {};\n\nconst console = {\n log: hasConsoleMethod('log') ? (...args) => window.console.log(...args) : noop,\n debug: hasConsoleMethod('debug') ? (...args) => window.console.debug(...args) : noop,\n info: hasConsoleMethod('info') ? (...args) => window.console.info(...args) : noop,\n warn: hasConsoleMethod('warn') ? (...args) => window.console.warn(...args) : noop,\n error: hasConsoleMethod('error') ? (...args) => window.console.error(...args) : noop,\n group: hasConsoleMethod('group') ? (...args) => window.console.group(...args) : noop,\n groupCollapsed: hasConsoleMethod('groupCollapsed')\n ? (...args) => window.console.groupCollapsed(...args)\n : noop,\n groupEnd: hasConsoleMethod('groupEnd') ? (...args) => window.console.groupEnd(...args) : noop,\n\n logWithDetails(message, lines) {\n console.groupCollapsed(message);\n lines.forEach(line => (Array.isArray(line) ? console.log(...line) : console.log(line)));\n console.groupEnd();\n },\n};\n\nexport default console;\n\nexport function logfmt(strings, ...values) {\n return [strings.join('%o'), ...(values || [])];\n}\n","module.exports = require(\"xmlserializer\");","module.exports = require(\"@splunk/visualization-context/IconContext\");","/* eslint-disable class-methods-use-this */\nimport React, { PureComponent } from 'react';\nimport T from 'prop-types';\nimport styled from 'styled-components';\nimport xmlserializer from 'xmlserializer';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport IconContext from '@splunk/visualization-context/IconContext';\nimport { toDimension } from './style';\nimport { shouldChangeFill, shouldChangeStroke, b64EncodeUnicode } from './iconUtils';\nimport console from './console';\n\nconst IconContainer = styled.div`\n ${props => toDimension({ width: props.width, height: props.height })};\n margin: auto;\n cursor: ${props => (props.onClick ? 'pointer' : 'inherit')};\n`;\nconst ColoredIcon = styled.img`\n ${props => toDimension({ width: props.width, height: props.height })};\n opacity: ${props => props.opacity || 1.0};\n`;\n\nclass RemoteIcon extends PureComponent {\n static contextType = IconContext;\n\n static propTypes = {\n iconURL: T.string,\n color: T.string,\n width: T.number,\n height: T.number,\n opacity: T.number,\n onIconClick: T.func,\n };\n\n static defaultProps = {\n width: 100,\n height: 100,\n opacity: 1.0,\n };\n\n static BASIC_SHAPES = ['path', 'rect', 'circle', 'ellipse', 'line', 'polyline', 'polygon'];\n\n constructor(props) {\n super(props);\n this.state = { iconDataURI: null };\n }\n\n // eslint-disable-next-line camelcase\n UNSAFE_componentWillMount() {\n this.getIcon(this.props.iconURL, this.props.color);\n }\n\n componentDidUpdate(prevProps) {\n if (prevProps.iconURL !== this.props.iconURL || prevProps.color !== this.props.color) {\n this.getIcon(this.props.iconURL, this.props.color);\n }\n }\n\n /**\n * Check if the iconURL is a registry URL/dataURI/direct URL and fetch from the registry when required\n * @param {String} iconURL\n * @param {String} color\n */\n async getIcon(iconURL, color) {\n const getIconDataURI = async () => {\n if (this.isRegistryURL(iconURL)) {\n const iconRegistry = this.context;\n if (iconRegistry) {\n try {\n const icon = await iconRegistry.getByURL(iconURL);\n return icon.dataURI;\n } catch (error) {\n console.error(_(error));\n }\n }\n } else {\n return iconURL;\n }\n return null;\n };\n\n const iconDataURI = await getIconDataURI();\n\n if (color) {\n this.colorIcon(iconDataURI, color);\n } else {\n this.setState({ iconDataURI });\n }\n }\n\n /**\n * check if icon is a registry url\n * @param {String} src\n */\n isRegistryURL(src = '') {\n const [type] = src.split('://');\n return type !== 'http' && type !== 'https' && !src.startsWith('data:image/svg+xml;base64');\n }\n\n /*\n * Color the icon:\n * parse svg elements from the dataURI, change color style of svg, and change fill/stroke attribute/style of each svg basic shapes\n * in the svg element to currentColor. At the end, convert the modified svg back to dataURI string.\n *\n * Limitation:\n * if the svg is created with multiple pathes with different fill attributes, this method would\n * convert all pathes' fill attribute to the color prop. It may change the view of the svg icon.\n *\n * @method colorIcon\n * @params {DataURI} dataURI\n * @params {String} color e.g. 'red' || '#ffffff'\n */\n colorIcon(dataURI, color) {\n fetch(dataURI)\n .then(response => response.text())\n .then(text => {\n const parser = new DOMParser();\n const xmlDoc = parser.parseFromString(text, 'text/xml');\n const svg = xmlDoc.getElementsByTagName('svg')[0];\n const children = svg.querySelectorAll('*');\n svg.style.color = color;\n\n // Todo: need move this to IconRegistry after figure out the jest issue with XMLSerializer\n for (let i = 0; i < children.length; i += 1) {\n const child = children[i];\n\n if (RemoteIcon.BASIC_SHAPES.includes(child.tagName)) {\n const fillAttr = child.getAttribute('fill');\n const fillStyle = child.style && child.style.fill;\n const strokeAttr = child.getAttribute('stroke');\n const strokeStyle = child.style && child.style.stroke;\n\n if (shouldChangeFill({ fillAttr, fillStyle, strokeAttr, strokeStyle })) {\n child.style.fill = '';\n child.setAttribute('fill', 'currentColor');\n }\n\n if (shouldChangeStroke({ fillAttr, fillStyle, strokeAttr, strokeStyle })) {\n child.style.stroke = '';\n child.setAttribute('stroke', 'currentColor');\n }\n }\n }\n\n const svgStr = b64EncodeUnicode(xmlserializer.serializeToString(svg));\n const iconDataURI = `data:image/svg+xml;base64,${svgStr}`;\n this.setState({ iconDataURI });\n })\n .catch(() => {\n console.error(_('The icon cannot be colored properly.'));\n });\n }\n\n render() {\n const { iconDataURI } = this.state;\n const { width, height, opacity, onIconClick } = this.props;\n\n if (!iconDataURI) {\n return null;\n }\n return (\n <IconContainer width={width} height={height} onClick={onIconClick}>\n <ColoredIcon\n src={iconDataURI}\n alt=\"Remote Icon\"\n width={width}\n height={height}\n opacity={opacity}\n referrerPolicy=\"no-referrer\"\n />\n </IconContainer>\n );\n }\n}\n\nexport default RemoteIcon;\n"],"sourceRoot":""}