@splunk/visualizations-shared 25.4.0 → 25.5.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.
- package/Downloader.js +2 -2
- package/Downloader.js.map +1 -1
- package/FileDownloader.js +4 -4
- package/FileDownloader.js.map +1 -1
- package/JSONSchemaUtils.js +2 -2
- package/JSONSchemaUtils.js.map +1 -1
- package/Message.js +4 -4
- package/Message.js.map +1 -1
- package/RemoteIcon.js +15 -97
- package/RemoteIcon.js.map +1 -1
- package/RemoteImage.js +14 -23
- package/RemoteImage.js.map +1 -1
- package/SanitizeProps.js +4 -4
- package/SanitizeProps.js.map +1 -1
- package/SizeAwareWrapper.js +4 -4
- package/SizeAwareWrapper.js.map +1 -1
- package/VisualizationDocPage.js +11 -11
- package/VisualizationDocPage.js.map +1 -1
- package/colorConstants.js +4 -4
- package/colorConstants.js.map +1 -1
- package/colorUtils.js +2 -2
- package/colorUtils.js.map +1 -1
- package/configUtils.js +2 -2
- package/configUtils.js.map +1 -1
- package/console.js +14 -4
- package/console.js.map +1 -1
- package/dataSourceUtils.js +2 -2
- package/dataSourceUtils.js.map +1 -1
- package/domUtils.js +4 -4
- package/domUtils.js.map +1 -1
- package/hocUtils.js +13 -13
- package/hocUtils.js.map +1 -1
- package/i18n.js +4 -4
- package/i18n.js.map +1 -1
- package/mapUtils.js +2 -2
- package/mapUtils.js.map +1 -1
- package/numberUtils.js +4 -4
- package/numberUtils.js.map +1 -1
- package/package.json +5 -5
- package/previewVizMessage.js +2 -2
- package/previewVizMessage.js.map +1 -1
- package/propUtils.js +6 -15
- package/propUtils.js.map +1 -1
- package/simpleXMLOptions.js +4 -4
- package/simpleXMLOptions.js.map +1 -1
- package/testHelper.js +2 -2
- package/testHelper.js.map +1 -1
- package/themeUtils.js +6 -6
- package/themeUtils.js.map +1 -1
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;;;QAG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;;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 = 50);\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/asyncToGenerator\"","webpack:///./src/iconUtils.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","IconContainer","styled","props","ColoredIcon","RemoteIcon","iconDataURI","prevProps","getIconDataURI","iconRegistry","console","_","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;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,YAAM;AACT;AACAJ,eAAO,CAAPA,MAAcC,gEAAC,CAAfD,sCAAe,CAAfA;AArCRI;AAuCH;;;WAED,kBAAS;AAAA,UACGR,WADH,GACmB,KADnB,KACmB,CADnB;AAAA,wBAE2C,KAF3C;AAAA,UAEGlC,KAFH;AAAA,UAEUC,MAFV;AAAA,UAEkBmD,OAFlB;AAAA,UAE2BC,WAF3B;;AAIL,UAAI,CAAJ,aAAkB;AACd;AACH;;AACD,0BACI;AAAe,aAAK,EAApB;AAA6B,cAAM,EAAnC;AAA6C,eAAO,EAAEA;AAAtD,sBACI;AACI,WAAG,EADP;AAEI,WAAG,EAFP;AAGI,aAAK,EAHT;AAII,cAAM,EAJV;AAKI,eAAO,EALX;AAMI,sBAAc,EAAC;AANnB,QADJ,CADJ;AAYH;;;;EAxJoBC,oD;;6EAAnBrB,U,iBACmBsB,iF;;6EADnBtB,U,eAGiB;AACfuB,SAAO,EAAEC,kDAAC,CADK;AAEfC,OAAK,EAAED,kDAAC,CAFO;AAGfzD,OAAK,EAAEyD,kDAAC,CAHO;AAIfxD,QAAM,EAAEwD,kDAAC,CAJM;AAKfL,SAAO,EAAEK,kDAAC,CALK;AAMfJ,aAAW,EAAEI,kDAAC,CAACE;AANA,C;;6EAHjB1B,U,kBAYoB;AAClBjC,OAAK,EADa;AAElBC,QAAM,EAFY;AAGlBmD,SAAO,EAAE;AAHS,C;;6EAZpBnB,U,kBAkBoB,oE;;AAyI1B,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/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","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';\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 // eslint-disable-next-line no-console\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 // eslint-disable-next-line no-console\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":""}
|
package/RemoteImage.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 =
|
|
90
|
+
/******/ return __webpack_require__(__webpack_require__.s = 49);
|
|
91
91
|
/******/ })
|
|
92
92
|
/************************************************************************/
|
|
93
93
|
/******/ ([
|
|
@@ -186,38 +186,33 @@ module.exports = require("@babel/runtime/helpers/asyncToGenerator");
|
|
|
186
186
|
/* 22 */,
|
|
187
187
|
/* 23 */,
|
|
188
188
|
/* 24 */,
|
|
189
|
-
/* 25
|
|
190
|
-
/***/ (function(module, exports) {
|
|
191
|
-
|
|
192
|
-
module.exports = require("@splunk/visualizations-shared/console");
|
|
193
|
-
|
|
194
|
-
/***/ }),
|
|
189
|
+
/* 25 */,
|
|
195
190
|
/* 26 */,
|
|
196
191
|
/* 27 */,
|
|
197
192
|
/* 28 */,
|
|
198
193
|
/* 29 */,
|
|
199
194
|
/* 30 */,
|
|
200
195
|
/* 31 */,
|
|
201
|
-
/* 32
|
|
202
|
-
/* 33 */,
|
|
203
|
-
/* 34 */
|
|
196
|
+
/* 32 */
|
|
204
197
|
/***/ (function(module, exports) {
|
|
205
198
|
|
|
206
199
|
module.exports = require("lodash/pick");
|
|
207
200
|
|
|
208
201
|
/***/ }),
|
|
209
|
-
/*
|
|
202
|
+
/* 33 */
|
|
210
203
|
/***/ (function(module, exports) {
|
|
211
204
|
|
|
212
205
|
module.exports = require("@splunk/visualization-context/ImageContext");
|
|
213
206
|
|
|
214
207
|
/***/ }),
|
|
215
|
-
/*
|
|
208
|
+
/* 34 */
|
|
216
209
|
/***/ (function(module, exports) {
|
|
217
210
|
|
|
218
211
|
module.exports = require("@splunk/visualizations-shared/style");
|
|
219
212
|
|
|
220
213
|
/***/ }),
|
|
214
|
+
/* 35 */,
|
|
215
|
+
/* 36 */,
|
|
221
216
|
/* 37 */,
|
|
222
217
|
/* 38 */,
|
|
223
218
|
/* 39 */,
|
|
@@ -230,9 +225,7 @@ module.exports = require("@splunk/visualizations-shared/style");
|
|
|
230
225
|
/* 46 */,
|
|
231
226
|
/* 47 */,
|
|
232
227
|
/* 48 */,
|
|
233
|
-
/* 49
|
|
234
|
-
/* 50 */,
|
|
235
|
-
/* 51 */
|
|
228
|
+
/* 49 */
|
|
236
229
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
237
230
|
|
|
238
231
|
"use strict";
|
|
@@ -264,16 +257,14 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
264
257
|
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_11__);
|
|
265
258
|
/* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(13);
|
|
266
259
|
/* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_12___default = /*#__PURE__*/__webpack_require__.n(styled_components__WEBPACK_IMPORTED_MODULE_12__);
|
|
267
|
-
/* harmony import */ var lodash_pick__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(
|
|
260
|
+
/* harmony import */ var lodash_pick__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(32);
|
|
268
261
|
/* harmony import */ var lodash_pick__WEBPACK_IMPORTED_MODULE_13___default = /*#__PURE__*/__webpack_require__.n(lodash_pick__WEBPACK_IMPORTED_MODULE_13__);
|
|
269
262
|
/* harmony import */ var _splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(7);
|
|
270
263
|
/* harmony import */ var _splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_14___default = /*#__PURE__*/__webpack_require__.n(_splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_14__);
|
|
271
|
-
/* harmony import */ var _splunk_visualization_context_ImageContext__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(
|
|
264
|
+
/* harmony import */ var _splunk_visualization_context_ImageContext__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(33);
|
|
272
265
|
/* harmony import */ var _splunk_visualization_context_ImageContext__WEBPACK_IMPORTED_MODULE_15___default = /*#__PURE__*/__webpack_require__.n(_splunk_visualization_context_ImageContext__WEBPACK_IMPORTED_MODULE_15__);
|
|
273
|
-
/* harmony import */ var _splunk_visualizations_shared_style__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(
|
|
266
|
+
/* harmony import */ var _splunk_visualizations_shared_style__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(34);
|
|
274
267
|
/* harmony import */ var _splunk_visualizations_shared_style__WEBPACK_IMPORTED_MODULE_16___default = /*#__PURE__*/__webpack_require__.n(_splunk_visualizations_shared_style__WEBPACK_IMPORTED_MODULE_16__);
|
|
275
|
-
/* harmony import */ var _splunk_visualizations_shared_console__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(25);
|
|
276
|
-
/* harmony import */ var _splunk_visualizations_shared_console__WEBPACK_IMPORTED_MODULE_17___default = /*#__PURE__*/__webpack_require__.n(_splunk_visualizations_shared_console__WEBPACK_IMPORTED_MODULE_17__);
|
|
277
268
|
|
|
278
269
|
|
|
279
270
|
|
|
@@ -327,7 +318,6 @@ function _isNativeReflectConstruct() {
|
|
|
327
318
|
|
|
328
319
|
|
|
329
320
|
|
|
330
|
-
|
|
331
321
|
/**
|
|
332
322
|
* check if an image is considered as remote image
|
|
333
323
|
* @param {*} src
|
|
@@ -422,8 +412,9 @@ var RemoteImage = /*#__PURE__*/function (_PureComponent) {
|
|
|
422
412
|
|
|
423
413
|
case 9:
|
|
424
414
|
_context.prev = 9;
|
|
425
|
-
_context.t0 = _context["catch"](2);
|
|
426
|
-
|
|
415
|
+
_context.t0 = _context["catch"](2); // eslint-disable-next-line no-console
|
|
416
|
+
|
|
417
|
+
console.error(_context.t0);
|
|
427
418
|
|
|
428
419
|
case 12:
|
|
429
420
|
case "end":
|
package/RemoteImage.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:///external \"@babel/runtime/helpers/asyncToGenerator\"","webpack:///external \"@splunk/visualizations-shared/console\"","webpack:///external \"lodash/pick\"","webpack:///external \"@splunk/visualization-context/ImageContext\"","webpack:///external \"@splunk/visualizations-shared/style\"","webpack:///./src/RemoteImage.jsx"],"names":["isRemoteImage","src","type","toImageDimensions","props","toDimension","pick","Image","styled","RemoteImage","imageDataURI","preserveAspectRatio","prevProps","imageRegistry","image","dataURI","console","width","height","title","_","e","PureComponent","ImageContext","imageURL","T","string"],"mappings":";;;;;;;QAAA;QACA;;Q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AAmB;AACf;AACH;;AACD,0BACI;AACI,WAAG,EADP;AAEI,iCAAyB,EAAE,WAF/B;AAGI,aAAK,EAHT;AAII,cAAM,EAJV;AAKI,WAAG,EAAEC,gEAAC,CALV,KAKU,CALV;AAMI,eAAO,EAAE,oBAAK;AACVC,WAAC,CAADA,aAAeD,gEAAC,CAAhBC,iBAAgB,CAAhBA;AACH;AARL,QADJ;AAYH;;;;EAjEqBC,oD;;6EAApBb,W,iBACmBc,kF;;6EADnBd,W,eAGiB;AACfe,UAAQ,EAAEC,kDAAC,CADI;AAEfR,OAAK,EAAEQ,kDAAC,CAADA,UAAY,CAACA,kDAAC,CAAF,QAAWA,kDAAC,CAFhB,MAEI,CAAZA,CAFQ;AAGfP,QAAM,EAAEO,kDAAC,CAADA,UAAY,CAACA,kDAAC,CAAF,QAAWA,kDAAC,CAHjB,MAGK,CAAZA,CAHO;AAIfd,qBAAmB,EAAEc,kDAAC,CAJP;AAKfN,OAAK,EAAEM,kDAAC,CAACC;AALM,C;;6EAHjBjB,W,kBAWoB;AAClBE,qBAAmB,EAAE;AADH,C;;AAyD1B,4E","file":"RemoteImage.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 = 51);\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\");","module.exports = require(\"@babel/runtime/helpers/asyncToGenerator\");","module.exports = require(\"@splunk/visualizations-shared/console\");","module.exports = require(\"lodash/pick\");","module.exports = require(\"@splunk/visualization-context/ImageContext\");","module.exports = require(\"@splunk/visualizations-shared/style\");","import React, { PureComponent } from 'react';\nimport T from 'prop-types';\nimport styled from 'styled-components';\nimport pick from 'lodash/pick';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport ImageContext from '@splunk/visualization-context/ImageContext';\nimport { toDimension } from '@splunk/visualizations-shared/style';\nimport console from '@splunk/visualizations-shared/console';\n\n/**\n * check if an image is considered as remote image\n * @param {*} src\n */\nexport const isRemoteImage = (src = '') => {\n const [type] = src.split('://');\n return src.indexOf('://') > -1 && type !== 'http' && type !== 'https';\n};\n\nconst toImageDimensions = props => {\n if (props.shouldPreserveAspectRatio) {\n return `\n max-width: 100%;\n max-height: 100%;\n width: auto;\n height: auto;\n `;\n }\n return toDimension(pick(props, ['width', 'height']));\n};\n\nconst Image = styled.img`\n display: block;\n ${props => toImageDimensions(props)};\n`;\n\nclass RemoteImage extends PureComponent {\n static contextType = ImageContext;\n\n static propTypes = {\n imageURL: T.string,\n width: T.oneOfType([T.string, T.number]),\n height: T.oneOfType([T.string, T.number]),\n preserveAspectRatio: T.bool,\n title: T.string,\n };\n\n static defaultProps = {\n preserveAspectRatio: false,\n };\n\n constructor(props) {\n super(props);\n this.state = { imageDataURI: null, preserveAspectRatio: props.preserveAspectRatio };\n }\n\n componentDidMount() {\n this.getImage(this.props.imageURL);\n }\n\n componentDidUpdate(prevProps) {\n if (prevProps.imageURL !== this.props.imageURL) {\n this.getImage(this.props.imageURL);\n }\n if (prevProps.preserveAspectRatio !== this.props.preserveAspectRatio) {\n // eslint-disable-next-line react/no-did-update-set-state\n this.setState({ preserveAspectRatio: this.props.preserveAspectRatio });\n }\n }\n\n async getImage(imageURL) {\n const imageRegistry = this.context;\n if (imageRegistry) {\n try {\n const image = await imageRegistry.getByURL(imageURL);\n this.setState({ imageDataURI: image.dataURI });\n } catch (error) {\n console.error(error);\n }\n }\n }\n\n render() {\n const { imageDataURI } = this.state;\n const { width, height, title } = this.props;\n\n if (!imageDataURI) {\n return null;\n }\n return (\n <Image\n src={imageDataURI}\n shouldPreserveAspectRatio={this.state.preserveAspectRatio}\n width={width}\n height={height}\n alt={_(title)}\n onError={e => {\n e.target.alt = _('Image not found');\n }}\n />\n );\n }\n}\n\nexport default RemoteImage;\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:///external \"@babel/runtime/helpers/asyncToGenerator\"","webpack:///external \"lodash/pick\"","webpack:///external \"@splunk/visualization-context/ImageContext\"","webpack:///external \"@splunk/visualizations-shared/style\"","webpack:///./src/RemoteImage.jsx"],"names":["isRemoteImage","src","type","toImageDimensions","props","toDimension","pick","Image","styled","RemoteImage","imageDataURI","preserveAspectRatio","prevProps","imageRegistry","image","dataURI","console","width","height","title","_","e","PureComponent","ImageContext","imageURL","T","string"],"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,oE;;;;;;;;;;;;;;;;;ACAA,wC;;;;;;ACAA,uE;;;;;;ACAA,gE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;;AACO,IAAMA,aAAa,GAAG,SAAhBA,aAAgB,GAAc;AAAA,MAAbC,GAAa,uEAAP,EAAO;;AAAA,mBACxBA,GAAG,CAAHA,MADwB,KACxBA,CADwB;AAAA;AAAA,MAChCC,IADgC;;AAEvC,SAAOD,GAAG,CAAHA,iBAAqB,CAArBA,KAA2BC,IAAI,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kBC,KAFlB;;AAIL,UAAI,CAAJ,cAAmB;AACf;AACH;;AACD,0BACI;AACI,WAAG,EADP;AAEI,iCAAyB,EAAE,WAF/B;AAGI,aAAK,EAHT;AAII,cAAM,EAJV;AAKI,WAAG,EAAEC,gEAAC,CALV,KAKU,CALV;AAMI,eAAO,EAAE,oBAAK;AACVC,WAAC,CAADA,aAAeD,gEAAC,CAAhBC,iBAAgB,CAAhBA;AACH;AARL,QADJ;AAYH;;;;EAlEqBC,oD;;6EAApBb,W,iBACmBc,kF;;6EADnBd,W,eAGiB;AACfe,UAAQ,EAAEC,kDAAC,CADI;AAEfR,OAAK,EAAEQ,kDAAC,CAADA,UAAY,CAACA,kDAAC,CAAF,QAAWA,kDAAC,CAFhB,MAEI,CAAZA,CAFQ;AAGfP,QAAM,EAAEO,kDAAC,CAADA,UAAY,CAACA,kDAAC,CAAF,QAAWA,kDAAC,CAHjB,MAGK,CAAZA,CAHO;AAIfd,qBAAmB,EAAEc,kDAAC,CAJP;AAKfN,OAAK,EAAEM,kDAAC,CAACC;AALM,C;;6EAHjBjB,W,kBAWoB;AAClBE,qBAAmB,EAAE;AADH,C;;AA0D1B,4E","file":"RemoteImage.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 = 49);\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\");","module.exports = require(\"@babel/runtime/helpers/asyncToGenerator\");","module.exports = require(\"lodash/pick\");","module.exports = require(\"@splunk/visualization-context/ImageContext\");","module.exports = require(\"@splunk/visualizations-shared/style\");","import React, { PureComponent } from 'react';\nimport T from 'prop-types';\nimport styled from 'styled-components';\nimport pick from 'lodash/pick';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport ImageContext from '@splunk/visualization-context/ImageContext';\nimport { toDimension } from '@splunk/visualizations-shared/style';\n\n/**\n * check if an image is considered as remote image\n * @param {*} src\n */\nexport const isRemoteImage = (src = '') => {\n const [type] = src.split('://');\n return src.indexOf('://') > -1 && type !== 'http' && type !== 'https';\n};\n\nconst toImageDimensions = props => {\n if (props.shouldPreserveAspectRatio) {\n return `\n max-width: 100%;\n max-height: 100%;\n width: auto;\n height: auto;\n `;\n }\n return toDimension(pick(props, ['width', 'height']));\n};\n\nconst Image = styled.img`\n display: block;\n ${props => toImageDimensions(props)};\n`;\n\nclass RemoteImage extends PureComponent {\n static contextType = ImageContext;\n\n static propTypes = {\n imageURL: T.string,\n width: T.oneOfType([T.string, T.number]),\n height: T.oneOfType([T.string, T.number]),\n preserveAspectRatio: T.bool,\n title: T.string,\n };\n\n static defaultProps = {\n preserveAspectRatio: false,\n };\n\n constructor(props) {\n super(props);\n this.state = { imageDataURI: null, preserveAspectRatio: props.preserveAspectRatio };\n }\n\n componentDidMount() {\n this.getImage(this.props.imageURL);\n }\n\n componentDidUpdate(prevProps) {\n if (prevProps.imageURL !== this.props.imageURL) {\n this.getImage(this.props.imageURL);\n }\n if (prevProps.preserveAspectRatio !== this.props.preserveAspectRatio) {\n // eslint-disable-next-line react/no-did-update-set-state\n this.setState({ preserveAspectRatio: this.props.preserveAspectRatio });\n }\n }\n\n async getImage(imageURL) {\n const imageRegistry = this.context;\n if (imageRegistry) {\n try {\n const image = await imageRegistry.getByURL(imageURL);\n this.setState({ imageDataURI: image.dataURI });\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error(error);\n }\n }\n }\n\n render() {\n const { imageDataURI } = this.state;\n const { width, height, title } = this.props;\n\n if (!imageDataURI) {\n return null;\n }\n return (\n <Image\n src={imageDataURI}\n shouldPreserveAspectRatio={this.state.preserveAspectRatio}\n width={width}\n height={height}\n alt={_(title)}\n onError={e => {\n e.target.alt = _('Image not found');\n }}\n />\n );\n }\n}\n\nexport default RemoteImage;\n"],"sourceRoot":""}
|
package/SanitizeProps.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 =
|
|
90
|
+
/******/ return __webpack_require__(__webpack_require__.s = 50);
|
|
91
91
|
/******/ })
|
|
92
92
|
/************************************************************************/
|
|
93
93
|
/******/ ({
|
|
@@ -389,7 +389,7 @@ exports.default = ['transparent', 'aliceblue', 'antiquewhite', 'aqua', 'aquamari
|
|
|
389
389
|
|
|
390
390
|
/***/ }),
|
|
391
391
|
|
|
392
|
-
/***/
|
|
392
|
+
/***/ 26:
|
|
393
393
|
/***/ (function(module, exports, __webpack_require__) {
|
|
394
394
|
|
|
395
395
|
"use strict";
|
|
@@ -472,7 +472,7 @@ module.exports = require("lodash");
|
|
|
472
472
|
|
|
473
473
|
/***/ }),
|
|
474
474
|
|
|
475
|
-
/***/
|
|
475
|
+
/***/ 50:
|
|
476
476
|
/***/ (function(module, exports, __webpack_require__) {
|
|
477
477
|
|
|
478
478
|
"use strict";
|
|
@@ -488,7 +488,7 @@ var React = __webpack_require__(1);
|
|
|
488
488
|
|
|
489
489
|
var lodash_1 = __webpack_require__(3);
|
|
490
490
|
|
|
491
|
-
var colorUtils_1 = __webpack_require__(
|
|
491
|
+
var colorUtils_1 = __webpack_require__(26);
|
|
492
492
|
|
|
493
493
|
var propsKeyValidators = {
|
|
494
494
|
backgroundColor: colorUtils_1.isColor,
|
package/SanitizeProps.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"react\"","webpack:///./src/schemaUtils.js","webpack:///./src/namedColors.ts","webpack:///./src/colorUtils.ts","webpack:///external \"lodash\"","webpack:///./src/SanitizeProps.tsx"],"names":["$schema","$id","title","definitions","schemaArray","type","minItems","items","$ref","nonNegativeInteger","minimum","nonNegativeIntegerDefault0","allOf","default","simpleTypes","enum","stringArray","uniqueItems","properties","format","$comment","description","readOnly","examples","multipleOf","exclusiveMinimum","maximum","exclusiveMaximum","maxLength","minLength","pattern","additionalItems","anyOf","maxItems","contains","maxProperties","minProperties","required","additionalProperties","patternProperties","propertyNames","dependencies","const","contentMediaType","contentEncoding","if","then","else","oneOf","not","createTestSchema","optionsSchema","TOKEN_NAMESPACE_PREFIX_PATTERN","TOKEN_NAME_CHARS_PATTERN","TOKEN_PATTERN","rgbColorPattern","rgbaColorPattern","colorPattern","colorPatternWithRGBA","COLOR_OR_TOKEN_PATTERN","COLOR_OR_TOKEN_PATTERN_WITH_RGBA","DYNAMIC_OPTIONS_DSL_PATTERN","getPattern"],"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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GAAG,KAAK,SAAR,IAAqB,uBAAc,KAAK,CAAC,OAApB,CAAzB,EAAuD;AACnD,WAAK,CAAC,GAAD,CAAL,GAAa,QAAQ,CAAC,KAAK,CAAC,OAAP,CAArB;AACH,KAFD,MAEO,IAAI,eAAe,CAAC,GAAD,EAAM,KAAK,CAAC,GAAD,CAAX,CAAnB,EAAsC;AACzC,WAAK,CAAC,GAAD,CAAL,GAAa,KAAK,CAAC,GAAD,CAAlB;AACH;;AACD,WAAO,KAAP;AACH,GAPM,EAOJ,EAPI,CAAP;AAQH;;AATD;AAWA;;;;;;AAMG;;AACH,SAAgB,kBAAhB,CACI,gBADJ,EAC4C;AAExC,MAAM,OAAO,GAAG,SAAV,OAAU,CAAC,KAAD,EAAa;AACzB,QAAM,cAAc,GAAG,QAAQ,CAAC,KAAD,CAA/B;AACA,WAAO,oBAAC,gBAAD,EAAiB,kBAAM,cAAN,CAAjB,CAAP;AACH,GAHD;;AAIA,SAAO,OAAP;AACH;;AARD,gD","file":"SanitizeProps.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 = 52);\n","module.exports = require(\"react\");","export default {\n $schema: 'http://json-schema.org/draft-07/schema#',\n $id: 'http://json-schema.org/draft-07/schema#',\n title: 'Core schema meta-schema',\n definitions: {\n schemaArray: {\n type: 'array',\n minItems: 1,\n items: { $ref: '#' },\n },\n nonNegativeInteger: {\n type: 'integer',\n minimum: 0,\n },\n nonNegativeIntegerDefault0: {\n allOf: [{ $ref: '#/definitions/nonNegativeInteger' }, { default: 0 }],\n },\n simpleTypes: {\n enum: ['array', 'boolean', 'integer', 'null', 'number', 'object', 'string'],\n },\n stringArray: {\n type: 'array',\n items: { type: 'string' },\n uniqueItems: true,\n default: [],\n },\n },\n type: ['object', 'boolean'],\n properties: {\n $id: {\n type: 'string',\n format: 'uri-reference',\n },\n $schema: {\n type: 'string',\n format: 'uri',\n },\n $ref: {\n type: 'string',\n format: 'uri-reference',\n },\n $comment: {\n type: 'string',\n },\n title: {\n type: 'string',\n },\n description: {\n type: 'string',\n },\n default: true,\n readOnly: {\n type: 'boolean',\n default: false,\n },\n examples: {\n type: 'array',\n items: true,\n },\n multipleOf: {\n type: 'number',\n exclusiveMinimum: 0,\n },\n maximum: {\n type: 'number',\n },\n exclusiveMaximum: {\n type: 'number',\n },\n minimum: {\n type: 'number',\n },\n exclusiveMinimum: {\n type: 'number',\n },\n maxLength: { $ref: '#/definitions/nonNegativeInteger' },\n minLength: { $ref: '#/definitions/nonNegativeIntegerDefault0' },\n pattern: {\n type: 'string',\n format: 'regex',\n },\n additionalItems: { $ref: '#' },\n items: {\n anyOf: [{ $ref: '#' }, { $ref: '#/definitions/schemaArray' }],\n default: true,\n },\n maxItems: { $ref: '#/definitions/nonNegativeInteger' },\n minItems: { $ref: '#/definitions/nonNegativeIntegerDefault0' },\n uniqueItems: {\n type: 'boolean',\n default: false,\n },\n contains: { $ref: '#' },\n maxProperties: { $ref: '#/definitions/nonNegativeInteger' },\n minProperties: { $ref: '#/definitions/nonNegativeIntegerDefault0' },\n required: { $ref: '#/definitions/stringArray' },\n additionalProperties: { $ref: '#' },\n definitions: {\n type: 'object',\n additionalProperties: { $ref: '#' },\n default: {},\n },\n properties: {\n type: 'object',\n additionalProperties: { $ref: '#' },\n default: {},\n },\n patternProperties: {\n type: 'object',\n additionalProperties: { $ref: '#' },\n propertyNames: { format: 'regex' },\n default: {},\n },\n dependencies: {\n type: 'object',\n additionalProperties: {\n anyOf: [{ $ref: '#' }, { $ref: '#/definitions/stringArray' }],\n },\n },\n propertyNames: { $ref: '#' },\n const: true,\n enum: {\n type: 'array',\n items: true,\n minItems: 1,\n uniqueItems: true,\n },\n type: {\n anyOf: [\n { $ref: '#/definitions/simpleTypes' },\n {\n type: 'array',\n items: { $ref: '#/definitions/simpleTypes' },\n minItems: 1,\n uniqueItems: true,\n },\n ],\n },\n format: { type: 'string' },\n contentMediaType: { type: 'string' },\n contentEncoding: { type: 'string' },\n if: { $ref: '#' },\n then: { $ref: '#' },\n else: { $ref: '#' },\n allOf: { $ref: '#/definitions/schemaArray' },\n anyOf: { $ref: '#/definitions/schemaArray' },\n oneOf: { $ref: '#/definitions/schemaArray' },\n not: { $ref: '#' },\n },\n default: true,\n};\n\nexport const createTestSchema = optionsSchema => ({\n $schema: 'http://json-schema.org/draft-07/schema#',\n $id: 'http://www.splunk.com/dashboard.schema.json',\n title: 'Dashboard Definition',\n description: 'Dashboard Definition',\n type: 'object',\n properties: optionsSchema,\n});\n\n// Below 2 regexs are copied from dashboard-framework/packages/dashboard-utils/src/token.jsc\nconst TOKEN_NAMESPACE_PREFIX_PATTERN = /(\\w+:)?/.source;\n// ex: token.name|suh (old-style filter chain)\n// ex: token.name|lower|capitalize (new-style filter chain)\nconst TOKEN_NAME_CHARS_PATTERN = /([^$|:]+?)(\\|[|\\w]+)?/.source;\n\nexport const TOKEN_PATTERN =\n /\\$/.source + TOKEN_NAMESPACE_PREFIX_PATTERN + TOKEN_NAME_CHARS_PATTERN + /\\$/.source;\n// rgb and rgba regexes were derived from:\n// https://stackoverflow.com/questions/9585973/javascript-regular-expression-for-rgb-values/9586150\n// https://github.com/regexhq/rgba-regex\n// NOTE: this will incorrectly accept values like rgb(999,999,999), but may be overkill to specify a regex that limits values to <= 255\nexport const rgbColorPattern = /^rgb\\(\\s*(\\d{1,3}),\\s*(\\d{1,3}),\\s*(\\d{1,3})\\)$/;\nexport const rgbaColorPattern = /^rgba\\(\\s*(\\d{1,3}%?),\\s*(\\d{1,3}%?),\\s*(\\d{1,3}%?),\\s*(\\d*(?:\\.\\d+)?)\\)$/;\n// todo: rename this to COLOR_PATTERN and replace all occurences.\nexport const colorPattern = '^#[0-9a-fA-F]{6}$|transparent';\nexport const colorPatternWithRGBA = `${colorPattern}|${rgbColorPattern.source}|${rgbaColorPattern.source}`;\nexport const COLOR_OR_TOKEN_PATTERN = `${colorPattern}|${TOKEN_PATTERN}`;\nexport const COLOR_OR_TOKEN_PATTERN_WITH_RGBA = `${colorPatternWithRGBA}|${TOKEN_PATTERN}`;\n// dynamic option DSL expressions always start with a >\nexport const DYNAMIC_OPTIONS_DSL_PATTERN = /^>.*/.source;\n/**\n * Returns the regex string that matches each passed in value as well as tokens.\n * @param {Array.<string>} values\n * @returns {string}\n */\nexport const getPattern = values =>\n values.reduce((accumulator, value) => `${accumulator}|^${value}$`, TOKEN_PATTERN);\n","// Reference - https://www.w3.org/TR/css-color-4/#named-colors\nexport default [\n 'transparent',\n 'aliceblue',\n 'antiquewhite',\n 'aqua',\n 'aquamarine',\n 'azure',\n 'beige',\n 'bisque',\n 'black',\n 'blanchedalmond',\n 'blue',\n 'blueviolet',\n 'brown',\n 'burlywood',\n 'cadetblue',\n 'chartreuse',\n 'chocolate',\n 'coral',\n 'cornflowerblue',\n 'cornsilk',\n 'crimson',\n 'cyan',\n 'darkblue',\n 'darkcyan',\n 'darkgoldenrod',\n 'darkgray',\n 'darkgreen',\n 'darkgrey',\n 'darkkhaki',\n 'darkmagenta',\n 'darkolivegreen',\n 'darkorange',\n 'darkorchid',\n 'darkred',\n 'darksalmon',\n 'darkseagreen',\n 'darkslateblue',\n 'darkslategray',\n 'darkslategrey',\n 'darkturquoise',\n 'darkviolet',\n 'deeppink',\n 'deepskyblue',\n 'dimgray',\n 'dimgrey',\n 'dodgerblue',\n 'firebrick',\n 'floralwhite',\n 'forestgreen',\n 'fuchsia',\n 'gainsboro',\n 'ghostwhite',\n 'gold',\n 'goldenrod',\n 'gray',\n 'green',\n 'greenyellow',\n 'grey',\n 'honeydew',\n 'hotpink',\n 'indianred',\n 'indigo',\n 'ivory',\n 'khaki',\n 'lavender',\n 'lavenderblush',\n 'lawngreen',\n 'lemonchiffon',\n 'lightblue',\n 'lightcoral',\n 'lightcyan',\n 'lightgoldenrodyellow',\n 'lightgray',\n 'lightgreen',\n 'lightgrey',\n 'lightpink',\n 'lightsalmon',\n 'lightseagreen',\n 'lightskyblue',\n 'lightslategray',\n 'lightslategrey',\n 'lightsteelblue',\n 'lightyellow',\n 'lime',\n 'limegreen',\n 'linen',\n 'magenta',\n 'maroon',\n 'mediumaquamarine',\n 'mediumblue',\n 'mediumorchid',\n 'mediumpurple',\n 'mediumseagreen',\n 'mediumslateblue',\n 'mediumspringgreen',\n 'mediumturquoise',\n 'mediumvioletred',\n 'midnightblue',\n 'mintcream',\n 'mistyrose',\n 'moccasin',\n 'navajowhite',\n 'navy',\n 'oldlace',\n 'olive',\n 'olivedrab',\n 'orange',\n 'orangered',\n 'orchid',\n 'palegoldenrod',\n 'palegreen',\n 'paleturquoise',\n 'palevioletred',\n 'papayawhip',\n 'peachpuff',\n 'peru',\n 'pink',\n 'plum',\n 'powderblue',\n 'purple',\n 'rebeccapurple',\n 'red',\n 'rosybrown',\n 'royalblue',\n 'saddlebrown',\n 'salmon',\n 'sandybrown',\n 'seagreen',\n 'seashell',\n 'sienna',\n 'silver',\n 'skyblue',\n 'slateblue',\n 'slategray',\n 'slategrey',\n 'snow',\n 'springgreen',\n 'steelblue',\n 'tan',\n 'teal',\n 'thistle',\n 'tomato',\n 'turquoise',\n 'violet',\n 'wheat',\n 'white',\n 'whitesmoke',\n 'yellow',\n 'yellowgreen',\n];\n","import { rgbColorPattern, rgbaColorPattern } from './schemaUtils';\nimport namedColors from './namedColors';\n\n/**\n * Validates if a given string is a valid color\n *\n * @param {string} color\n * @returns {boolean}\n */\nexport function isColor(color = ''): boolean {\n if (typeof color !== 'string') {\n return false;\n }\n if (color.charAt(0) === '#') {\n color = color.substring(1); // eslint-disable-line no-param-reassign\n return [3, 4, 6, 8].indexOf(color.length) > -1 && !Number.isNaN(parseInt(color, 16));\n }\n const trimmedColor = color.trim();\n if (rgbColorPattern.test(trimmedColor) || rgbaColorPattern.test(trimmedColor)) {\n return true;\n }\n return namedColors.includes(color.toLowerCase());\n // for future when we want to support rgb | hsl\n // return /^(rgb|hsl)a?\\((\\d+%?(deg|rad|grad|turn)?[,\\s]+){2,3}[\\s\\/]*[\\d\\.]+%?\\)$/i.test(color);\n}\n\n/**\n * Validates if a given array of strings is a valid array of colors\n * @param colors\n * @returns\n */\nexport const isArrayOfColors = (colors: string[]) => Array.isArray(colors) && colors.every(isColor);\n\n/**\n * Sanitizes an array of colors `arr` to replace any non-color values with undefined,\n * or the value of `fallback` if provided.\n *\n * @param arr\n * @param {string} fallback\n * @returns {string[]} sanitized array any non-color values replaced with `fallback`\n */\nexport const sanitizeArrayOfColors = (arr: any[], fallback?: string): string[] => {\n return arr.map(entry => (isColor(entry) ? entry : fallback));\n};\n","module.exports = require(\"lodash\");","/* eslint-disable no-param-reassign */\nimport * as React from 'react';\nimport { isPlainObject } from 'lodash';\nimport { isColor } from './colorUtils';\n\nconst propsKeyValidators = {\n backgroundColor: isColor,\n deltaColor: isColor, // SV react-visualizations & dashboard-visualizations\n trendColor: isColor, // SV visualizations\n fontColor: isColor,\n fillColor: isColor,\n gaugeColor: isColor,\n majorColor: isColor,\n radialBackgroundColor: isColor,\n radialStrokeColor: isColor,\n sparklineFillColor: isColor,\n sparklineStrokeColor: isColor,\n strokeColor: isColor,\n strokeHighlightColor: isColor,\n headerBackgroundColor: isColor,\n rowBackgroundColorOdd: isColor,\n rowBackgroundColorEven: isColor,\n headerTextColor: isColor,\n rowTextColorOdd: isColor,\n rowTextColorEven: isColor,\n color: isColor,\n textColor: isColor,\n defaultFontColor: isColor,\n defaultBlockFontColor: isColor,\n sparklineAreaColor: isColor,\n iconColor: isColor,\n areaColor: isColor,\n nodeColor: isColor,\n nodeHighlightColor: isColor,\n linkColor: isColor,\n nodeTextColor: isColor,\n nodeTextHighlightColor: isColor,\n};\n\n/**\n * Validates if a given key value pair are valid\n * based on a set of predefined rules.\n *\n * @param {string} key\n * @param {string} value\n * @returns {boolean}\n */\nfunction isValidProperty(key: string, value: string): boolean {\n const { hasOwnProperty } = Object.prototype;\n return hasOwnProperty.call(propsKeyValidators, key) ? propsKeyValidators[key](value) : true;\n}\n\n/**\n * Validates every property in the key and return\n * only valid keys\n *\n * @export\n * @template T\n * @param {T} props\n * @returns {Partial<T>}\n */\nexport function sanitize<T extends Record<string, any>>(props: T): Partial<T> {\n return Object.keys(props).reduce((accum, key) => {\n if (key === 'options' && isPlainObject(props.options)) {\n accum[key] = sanitize(props.options);\n } else if (isValidProperty(key, props[key])) {\n accum[key] = props[key];\n }\n return accum;\n }, {});\n}\n\n/**\n * Helper HOC which will sanitize invalid props\n *\n * @export\n * @param {React.ComponentType} WrappedComponent\n * @returns {React.ComponentType}\n */\nexport function withSanitizedProps<T>(\n WrappedComponent: React.ComponentType<T>\n): React.ComponentType<Partial<T>> {\n const Wrapper = (props: T) => {\n const sanitizedProps = sanitize(props);\n return <WrappedComponent {...(sanitizedProps as T)} />;\n };\n return Wrapper;\n}\n"],"sourceRoot":""}
|
|
1
|
+
{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"react\"","webpack:///./src/schemaUtils.js","webpack:///./src/namedColors.ts","webpack:///./src/colorUtils.ts","webpack:///external \"lodash\"","webpack:///./src/SanitizeProps.tsx"],"names":["$schema","$id","title","definitions","schemaArray","type","minItems","items","$ref","nonNegativeInteger","minimum","nonNegativeIntegerDefault0","allOf","default","simpleTypes","enum","stringArray","uniqueItems","properties","format","$comment","description","readOnly","examples","multipleOf","exclusiveMinimum","maximum","exclusiveMaximum","maxLength","minLength","pattern","additionalItems","anyOf","maxItems","contains","maxProperties","minProperties","required","additionalProperties","patternProperties","propertyNames","dependencies","const","contentMediaType","contentEncoding","if","then","else","oneOf","not","createTestSchema","optionsSchema","TOKEN_NAMESPACE_PREFIX_PATTERN","TOKEN_NAME_CHARS_PATTERN","TOKEN_PATTERN","rgbColorPattern","rgbaColorPattern","colorPattern","colorPatternWithRGBA","COLOR_OR_TOKEN_PATTERN","COLOR_OR_TOKEN_PATTERN_WITH_RGBA","DYNAMIC_OPTIONS_DSL_PATTERN","getPattern"],"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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAe;AACXA,SAAO,EADI;AAEXC,KAAG,EAFQ;AAGXC,OAAK,EAHM;AAIXC,aAAW,EAAE;AACTC,eAAW,EAAE;AACTC,UAAI,EADK;AAETC,cAAQ,EAFC;AAGTC,WAAK,EAAE;AAAEC,YAAI,EAAE;AAAR;AAHE,KADJ;AAMTC,sBAAkB,EAAE;AAChBJ,UAAI,EADY;AAEhBK,aAAO,EAAE;AAFO,KANX;AAUTC,8BAA0B,EAAE;AACxBC,WAAK,EAAE,CAAC;AAAEJ,YAAI,EAAE;AAAR,OAAD,EAA+C;AAAEK,eAAO,EAAE;AAAX,OAA/C;A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B,eAAa,EAAE,oBA9BQ;AA+BvB,wBAAsB,EAAE;AA/BD,CAA3B;AAkCA;;;;;;;AAOG;;AACH,SAAS,eAAT,CAAyB,GAAzB,EAAsC,KAAtC,EAAmD;AAAA,MACvC,cADuC,GACpB,MAAM,CAAC,SADa,CACvC,cADuC;AAE/C,SAAO,cAAc,CAAC,IAAf,CAAoB,kBAApB,EAAwC,GAAxC,IAA+C,kBAAkB,CAAC,GAAD,CAAlB,CAAwB,KAAxB,CAA/C,GAAgF,IAAvF;AACH;AAED;;;;;;;;AAQG;;;AACH,SAAgB,QAAhB,CAAwD,KAAxD,EAAgE;AAC5D,SAAO,MAAM,CAAC,IAAP,CAAY,KAAZ,EAAmB,MAAnB,CAA0B,UAAC,KAAD,EAAQ,GAAR,EAAe;AAC5C,QAAI,GAAG,KAAK,SAAR,IAAqB,uBAAc,KAAK,CAAC,OAApB,CAAzB,EAAuD;AACnD,WAAK,CAAC,GAAD,CAAL,GAAa,QAAQ,CAAC,KAAK,CAAC,OAAP,CAArB;AACH,KAFD,MAEO,IAAI,eAAe,CAAC,GAAD,EAAM,KAAK,CAAC,GAAD,CAAX,CAAnB,EAAsC;AACzC,WAAK,CAAC,GAAD,CAAL,GAAa,KAAK,CAAC,GAAD,CAAlB;AACH;;AACD,WAAO,KAAP;AACH,GAPM,EAOJ,EAPI,CAAP;AAQH;;AATD;AAWA;;;;;;AAMG;;AACH,SAAgB,kBAAhB,CACI,gBADJ,EAC4C;AAExC,MAAM,OAAO,GAAG,SAAV,OAAU,CAAC,KAAD,EAAa;AACzB,QAAM,cAAc,GAAG,QAAQ,CAAC,KAAD,CAA/B;AACA,WAAO,oBAAC,gBAAD,EAAiB,kBAAM,cAAN,CAAjB,CAAP;AACH,GAHD;;AAIA,SAAO,OAAP;AACH;;AARD,gD","file":"SanitizeProps.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 = 50);\n","module.exports = require(\"react\");","export default {\n $schema: 'http://json-schema.org/draft-07/schema#',\n $id: 'http://json-schema.org/draft-07/schema#',\n title: 'Core schema meta-schema',\n definitions: {\n schemaArray: {\n type: 'array',\n minItems: 1,\n items: { $ref: '#' },\n },\n nonNegativeInteger: {\n type: 'integer',\n minimum: 0,\n },\n nonNegativeIntegerDefault0: {\n allOf: [{ $ref: '#/definitions/nonNegativeInteger' }, { default: 0 }],\n },\n simpleTypes: {\n enum: ['array', 'boolean', 'integer', 'null', 'number', 'object', 'string'],\n },\n stringArray: {\n type: 'array',\n items: { type: 'string' },\n uniqueItems: true,\n default: [],\n },\n },\n type: ['object', 'boolean'],\n properties: {\n $id: {\n type: 'string',\n format: 'uri-reference',\n },\n $schema: {\n type: 'string',\n format: 'uri',\n },\n $ref: {\n type: 'string',\n format: 'uri-reference',\n },\n $comment: {\n type: 'string',\n },\n title: {\n type: 'string',\n },\n description: {\n type: 'string',\n },\n default: true,\n readOnly: {\n type: 'boolean',\n default: false,\n },\n examples: {\n type: 'array',\n items: true,\n },\n multipleOf: {\n type: 'number',\n exclusiveMinimum: 0,\n },\n maximum: {\n type: 'number',\n },\n exclusiveMaximum: {\n type: 'number',\n },\n minimum: {\n type: 'number',\n },\n exclusiveMinimum: {\n type: 'number',\n },\n maxLength: { $ref: '#/definitions/nonNegativeInteger' },\n minLength: { $ref: '#/definitions/nonNegativeIntegerDefault0' },\n pattern: {\n type: 'string',\n format: 'regex',\n },\n additionalItems: { $ref: '#' },\n items: {\n anyOf: [{ $ref: '#' }, { $ref: '#/definitions/schemaArray' }],\n default: true,\n },\n maxItems: { $ref: '#/definitions/nonNegativeInteger' },\n minItems: { $ref: '#/definitions/nonNegativeIntegerDefault0' },\n uniqueItems: {\n type: 'boolean',\n default: false,\n },\n contains: { $ref: '#' },\n maxProperties: { $ref: '#/definitions/nonNegativeInteger' },\n minProperties: { $ref: '#/definitions/nonNegativeIntegerDefault0' },\n required: { $ref: '#/definitions/stringArray' },\n additionalProperties: { $ref: '#' },\n definitions: {\n type: 'object',\n additionalProperties: { $ref: '#' },\n default: {},\n },\n properties: {\n type: 'object',\n additionalProperties: { $ref: '#' },\n default: {},\n },\n patternProperties: {\n type: 'object',\n additionalProperties: { $ref: '#' },\n propertyNames: { format: 'regex' },\n default: {},\n },\n dependencies: {\n type: 'object',\n additionalProperties: {\n anyOf: [{ $ref: '#' }, { $ref: '#/definitions/stringArray' }],\n },\n },\n propertyNames: { $ref: '#' },\n const: true,\n enum: {\n type: 'array',\n items: true,\n minItems: 1,\n uniqueItems: true,\n },\n type: {\n anyOf: [\n { $ref: '#/definitions/simpleTypes' },\n {\n type: 'array',\n items: { $ref: '#/definitions/simpleTypes' },\n minItems: 1,\n uniqueItems: true,\n },\n ],\n },\n format: { type: 'string' },\n contentMediaType: { type: 'string' },\n contentEncoding: { type: 'string' },\n if: { $ref: '#' },\n then: { $ref: '#' },\n else: { $ref: '#' },\n allOf: { $ref: '#/definitions/schemaArray' },\n anyOf: { $ref: '#/definitions/schemaArray' },\n oneOf: { $ref: '#/definitions/schemaArray' },\n not: { $ref: '#' },\n },\n default: true,\n};\n\nexport const createTestSchema = optionsSchema => ({\n $schema: 'http://json-schema.org/draft-07/schema#',\n $id: 'http://www.splunk.com/dashboard.schema.json',\n title: 'Dashboard Definition',\n description: 'Dashboard Definition',\n type: 'object',\n properties: optionsSchema,\n});\n\n// Below 2 regexs are copied from dashboard-framework/packages/dashboard-utils/src/token.jsc\nconst TOKEN_NAMESPACE_PREFIX_PATTERN = /(\\w+:)?/.source;\n// ex: token.name|suh (old-style filter chain)\n// ex: token.name|lower|capitalize (new-style filter chain)\nconst TOKEN_NAME_CHARS_PATTERN = /([^$|:]+?)(\\|[|\\w]+)?/.source;\n\nexport const TOKEN_PATTERN =\n /\\$/.source + TOKEN_NAMESPACE_PREFIX_PATTERN + TOKEN_NAME_CHARS_PATTERN + /\\$/.source;\n// rgb and rgba regexes were derived from:\n// https://stackoverflow.com/questions/9585973/javascript-regular-expression-for-rgb-values/9586150\n// https://github.com/regexhq/rgba-regex\n// NOTE: this will incorrectly accept values like rgb(999,999,999), but may be overkill to specify a regex that limits values to <= 255\nexport const rgbColorPattern = /^rgb\\(\\s*(\\d{1,3}),\\s*(\\d{1,3}),\\s*(\\d{1,3})\\)$/;\nexport const rgbaColorPattern = /^rgba\\(\\s*(\\d{1,3}%?),\\s*(\\d{1,3}%?),\\s*(\\d{1,3}%?),\\s*(\\d*(?:\\.\\d+)?)\\)$/;\n// todo: rename this to COLOR_PATTERN and replace all occurences.\nexport const colorPattern = '^#[0-9a-fA-F]{6}$|transparent';\nexport const colorPatternWithRGBA = `${colorPattern}|${rgbColorPattern.source}|${rgbaColorPattern.source}`;\nexport const COLOR_OR_TOKEN_PATTERN = `${colorPattern}|${TOKEN_PATTERN}`;\nexport const COLOR_OR_TOKEN_PATTERN_WITH_RGBA = `${colorPatternWithRGBA}|${TOKEN_PATTERN}`;\n// dynamic option DSL expressions always start with a >\nexport const DYNAMIC_OPTIONS_DSL_PATTERN = /^>.*/.source;\n/**\n * Returns the regex string that matches each passed in value as well as tokens.\n * @param {Array.<string>} values\n * @returns {string}\n */\nexport const getPattern = values =>\n values.reduce((accumulator, value) => `${accumulator}|^${value}$`, TOKEN_PATTERN);\n","// Reference - https://www.w3.org/TR/css-color-4/#named-colors\nexport default [\n 'transparent',\n 'aliceblue',\n 'antiquewhite',\n 'aqua',\n 'aquamarine',\n 'azure',\n 'beige',\n 'bisque',\n 'black',\n 'blanchedalmond',\n 'blue',\n 'blueviolet',\n 'brown',\n 'burlywood',\n 'cadetblue',\n 'chartreuse',\n 'chocolate',\n 'coral',\n 'cornflowerblue',\n 'cornsilk',\n 'crimson',\n 'cyan',\n 'darkblue',\n 'darkcyan',\n 'darkgoldenrod',\n 'darkgray',\n 'darkgreen',\n 'darkgrey',\n 'darkkhaki',\n 'darkmagenta',\n 'darkolivegreen',\n 'darkorange',\n 'darkorchid',\n 'darkred',\n 'darksalmon',\n 'darkseagreen',\n 'darkslateblue',\n 'darkslategray',\n 'darkslategrey',\n 'darkturquoise',\n 'darkviolet',\n 'deeppink',\n 'deepskyblue',\n 'dimgray',\n 'dimgrey',\n 'dodgerblue',\n 'firebrick',\n 'floralwhite',\n 'forestgreen',\n 'fuchsia',\n 'gainsboro',\n 'ghostwhite',\n 'gold',\n 'goldenrod',\n 'gray',\n 'green',\n 'greenyellow',\n 'grey',\n 'honeydew',\n 'hotpink',\n 'indianred',\n 'indigo',\n 'ivory',\n 'khaki',\n 'lavender',\n 'lavenderblush',\n 'lawngreen',\n 'lemonchiffon',\n 'lightblue',\n 'lightcoral',\n 'lightcyan',\n 'lightgoldenrodyellow',\n 'lightgray',\n 'lightgreen',\n 'lightgrey',\n 'lightpink',\n 'lightsalmon',\n 'lightseagreen',\n 'lightskyblue',\n 'lightslategray',\n 'lightslategrey',\n 'lightsteelblue',\n 'lightyellow',\n 'lime',\n 'limegreen',\n 'linen',\n 'magenta',\n 'maroon',\n 'mediumaquamarine',\n 'mediumblue',\n 'mediumorchid',\n 'mediumpurple',\n 'mediumseagreen',\n 'mediumslateblue',\n 'mediumspringgreen',\n 'mediumturquoise',\n 'mediumvioletred',\n 'midnightblue',\n 'mintcream',\n 'mistyrose',\n 'moccasin',\n 'navajowhite',\n 'navy',\n 'oldlace',\n 'olive',\n 'olivedrab',\n 'orange',\n 'orangered',\n 'orchid',\n 'palegoldenrod',\n 'palegreen',\n 'paleturquoise',\n 'palevioletred',\n 'papayawhip',\n 'peachpuff',\n 'peru',\n 'pink',\n 'plum',\n 'powderblue',\n 'purple',\n 'rebeccapurple',\n 'red',\n 'rosybrown',\n 'royalblue',\n 'saddlebrown',\n 'salmon',\n 'sandybrown',\n 'seagreen',\n 'seashell',\n 'sienna',\n 'silver',\n 'skyblue',\n 'slateblue',\n 'slategray',\n 'slategrey',\n 'snow',\n 'springgreen',\n 'steelblue',\n 'tan',\n 'teal',\n 'thistle',\n 'tomato',\n 'turquoise',\n 'violet',\n 'wheat',\n 'white',\n 'whitesmoke',\n 'yellow',\n 'yellowgreen',\n];\n","import { rgbColorPattern, rgbaColorPattern } from './schemaUtils';\nimport namedColors from './namedColors';\n\n/**\n * Validates if a given string is a valid color\n *\n * @param {string} color\n * @returns {boolean}\n */\nexport function isColor(color = ''): boolean {\n if (typeof color !== 'string') {\n return false;\n }\n if (color.charAt(0) === '#') {\n color = color.substring(1); // eslint-disable-line no-param-reassign\n return [3, 4, 6, 8].indexOf(color.length) > -1 && !Number.isNaN(parseInt(color, 16));\n }\n const trimmedColor = color.trim();\n if (rgbColorPattern.test(trimmedColor) || rgbaColorPattern.test(trimmedColor)) {\n return true;\n }\n return namedColors.includes(color.toLowerCase());\n // for future when we want to support rgb | hsl\n // return /^(rgb|hsl)a?\\((\\d+%?(deg|rad|grad|turn)?[,\\s]+){2,3}[\\s\\/]*[\\d\\.]+%?\\)$/i.test(color);\n}\n\n/**\n * Validates if a given array of strings is a valid array of colors\n * @param colors\n * @returns\n */\nexport const isArrayOfColors = (colors: string[]) => Array.isArray(colors) && colors.every(isColor);\n\n/**\n * Sanitizes an array of colors `arr` to replace any non-color values with undefined,\n * or the value of `fallback` if provided.\n *\n * @param arr\n * @param {string} fallback\n * @returns {string[]} sanitized array any non-color values replaced with `fallback`\n */\nexport const sanitizeArrayOfColors = (arr: any[], fallback?: string): string[] => {\n return arr.map(entry => (isColor(entry) ? entry : fallback));\n};\n","module.exports = require(\"lodash\");","/* eslint-disable no-param-reassign */\nimport * as React from 'react';\nimport { isPlainObject } from 'lodash';\nimport { isColor } from './colorUtils';\n\nconst propsKeyValidators = {\n backgroundColor: isColor,\n deltaColor: isColor, // SV react-visualizations & dashboard-visualizations\n trendColor: isColor, // SV visualizations\n fontColor: isColor,\n fillColor: isColor,\n gaugeColor: isColor,\n majorColor: isColor,\n radialBackgroundColor: isColor,\n radialStrokeColor: isColor,\n sparklineFillColor: isColor,\n sparklineStrokeColor: isColor,\n strokeColor: isColor,\n strokeHighlightColor: isColor,\n headerBackgroundColor: isColor,\n rowBackgroundColorOdd: isColor,\n rowBackgroundColorEven: isColor,\n headerTextColor: isColor,\n rowTextColorOdd: isColor,\n rowTextColorEven: isColor,\n color: isColor,\n textColor: isColor,\n defaultFontColor: isColor,\n defaultBlockFontColor: isColor,\n sparklineAreaColor: isColor,\n iconColor: isColor,\n areaColor: isColor,\n nodeColor: isColor,\n nodeHighlightColor: isColor,\n linkColor: isColor,\n nodeTextColor: isColor,\n nodeTextHighlightColor: isColor,\n};\n\n/**\n * Validates if a given key value pair are valid\n * based on a set of predefined rules.\n *\n * @param {string} key\n * @param {string} value\n * @returns {boolean}\n */\nfunction isValidProperty(key: string, value: string): boolean {\n const { hasOwnProperty } = Object.prototype;\n return hasOwnProperty.call(propsKeyValidators, key) ? propsKeyValidators[key](value) : true;\n}\n\n/**\n * Validates every property in the key and return\n * only valid keys\n *\n * @export\n * @template T\n * @param {T} props\n * @returns {Partial<T>}\n */\nexport function sanitize<T extends Record<string, any>>(props: T): Partial<T> {\n return Object.keys(props).reduce((accum, key) => {\n if (key === 'options' && isPlainObject(props.options)) {\n accum[key] = sanitize(props.options);\n } else if (isValidProperty(key, props[key])) {\n accum[key] = props[key];\n }\n return accum;\n }, {});\n}\n\n/**\n * Helper HOC which will sanitize invalid props\n *\n * @export\n * @param {React.ComponentType} WrappedComponent\n * @returns {React.ComponentType}\n */\nexport function withSanitizedProps<T>(\n WrappedComponent: React.ComponentType<T>\n): React.ComponentType<Partial<T>> {\n const Wrapper = (props: T) => {\n const sanitizedProps = sanitize(props);\n return <WrappedComponent {...(sanitizedProps as T)} />;\n };\n return Wrapper;\n}\n"],"sourceRoot":""}
|
package/SizeAwareWrapper.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 =
|
|
90
|
+
/******/ return __webpack_require__(__webpack_require__.s = 51);
|
|
91
91
|
/******/ })
|
|
92
92
|
/************************************************************************/
|
|
93
93
|
/******/ ({
|
|
@@ -127,7 +127,7 @@ module.exports = require("lodash");
|
|
|
127
127
|
|
|
128
128
|
/***/ }),
|
|
129
129
|
|
|
130
|
-
/***/
|
|
130
|
+
/***/ 35:
|
|
131
131
|
/***/ (function(module, exports) {
|
|
132
132
|
|
|
133
133
|
module.exports = require("resize-observer-polyfill");
|
|
@@ -148,7 +148,7 @@ module.exports = require("@babel/runtime/helpers/classCallCheck");
|
|
|
148
148
|
|
|
149
149
|
/***/ }),
|
|
150
150
|
|
|
151
|
-
/***/
|
|
151
|
+
/***/ 51:
|
|
152
152
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
153
153
|
|
|
154
154
|
"use strict";
|
|
@@ -173,7 +173,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
173
173
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_8__);
|
|
174
174
|
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(0);
|
|
175
175
|
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_9__);
|
|
176
|
-
/* harmony import */ var resize_observer_polyfill__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(
|
|
176
|
+
/* harmony import */ var resize_observer_polyfill__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(35);
|
|
177
177
|
/* harmony import */ var resize_observer_polyfill__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(resize_observer_polyfill__WEBPACK_IMPORTED_MODULE_10__);
|
|
178
178
|
|
|
179
179
|
|
package/SizeAwareWrapper.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"prop-types\"","webpack:///external \"react\"","webpack:///external \"@babel/runtime/helpers/assertThisInitialized\"","webpack:///external \"@babel/runtime/helpers/defineProperty\"","webpack:///external \"lodash\"","webpack:///external \"resize-observer-polyfill\"","webpack:///external \"@babel/runtime/helpers/getPrototypeOf\"","webpack:///external \"@babel/runtime/helpers/classCallCheck\"","webpack:///./src/SizeAwareWrapper.jsx","webpack:///external \"@babel/runtime/helpers/createClass\"","webpack:///external \"@babel/runtime/helpers/inherits\"","webpack:///external \"@babel/runtime/helpers/possibleConstructorReturn\""],"names":["styles","position","width","height","visibility","display","SizeAwareWrapper","parentElement","entries","entry","children","isFunction","resizableElement","window","PureComponent","T"],"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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;;AACA,4BAAsB;AAClB;AACH;AACJ;;;WAED,gCAAuB;AACnB,UAAMA,gBAAgB,GAAG,KAAzB,UAAyB,EAAzB;;AACA,4BAAsB;AAClB;AACH;;AACD,UAAIC,MAAM,IAAI,KAAd,kBAAqC;AACjCA,cAAM,CAANA,qBAA4B,KAA5BA;AACH;AACJ;;;WA4BD,kBAAS;AAAA;;AACL,0BACI,2DAAC,4CAAD,8BACI;AACI,WAAG,EADP;AAEI,aAAK,EAFT;AAGI,WAAG,EAAE,iBAAM;AACP,gBAAI,CAAJ;AACH;AALL,QADJ,EAQK,KATT,cASS,EARL,CADJ;AAYH;;;;EAnE0BC,mD;;AAsE/BR,gBAAgB,CAAhBA,YAA6B;AACzBI,UAAQ,EAAEK,iDAAC,CADc,IACR;;AADQ,CAA7BT;AAIAA,gBAAgB,CAAhBA,eAAgC;AAC5BI,UAAQ,EAAE;AADkB,CAAhCJ;AAIA,iF;;;;;;;AC3FA,+D;;;;;;;ACAA,4D;;;;;;;ACAA,6E","file":"SizeAwareWrapper.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 =
|
|
1
|
+
{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"prop-types\"","webpack:///external \"react\"","webpack:///external \"@babel/runtime/helpers/assertThisInitialized\"","webpack:///external \"@babel/runtime/helpers/defineProperty\"","webpack:///external \"lodash\"","webpack:///external \"resize-observer-polyfill\"","webpack:///external \"@babel/runtime/helpers/getPrototypeOf\"","webpack:///external \"@babel/runtime/helpers/classCallCheck\"","webpack:///./src/SizeAwareWrapper.jsx","webpack:///external \"@babel/runtime/helpers/createClass\"","webpack:///external \"@babel/runtime/helpers/inherits\"","webpack:///external \"@babel/runtime/helpers/possibleConstructorReturn\""],"names":["styles","position","width","height","visibility","display","SizeAwareWrapper","parentElement","entries","entry","children","isFunction","resizableElement","window","PureComponent","T"],"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,kE;;;;;;;ACAA,mC;;;;;;;ACAA,qD;;;;;;;ACAA,kE;;;;;;;ACAA,kE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACAA;AACA;AACA;AACA;AAEA,IAAMA,MAAM,GAAG;AACXC,UAAQ,EADG;AAEXC,OAAK,EAFM;AAGXC,QAAM,EAHK;AAIXC,YAAU,EAJC;AAKXC,SAAO,EAAE;AALE,CAAf;;IAQMC,gB;;;;;AACF,mCAAmB;AAAA;;AAAA;;AACf;;AADe,2LA2BN,YAAM;AACf;AACA,UAAM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AgB,CAAhBA,YAA6B;AACzBI,UAAQ,EAAEK,iDAAC,CADc,IACR;;AADQ,CAA7BT;AAIAA,gBAAgB,CAAhBA,eAAgC;AAC5BI,UAAQ,EAAE;AADkB,CAAhCJ;AAIA,iF;;;;;;;AC3FA,+D;;;;;;;ACAA,4D;;;;;;;ACAA,6E","file":"SizeAwareWrapper.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 = 51);\n","module.exports = require(\"prop-types\");","module.exports = require(\"react\");","module.exports = require(\"@babel/runtime/helpers/assertThisInitialized\");","module.exports = require(\"@babel/runtime/helpers/defineProperty\");","module.exports = require(\"lodash\");","module.exports = require(\"resize-observer-polyfill\");","module.exports = require(\"@babel/runtime/helpers/getPrototypeOf\");","module.exports = require(\"@babel/runtime/helpers/classCallCheck\");","import isFunction from 'lodash';\nimport React, { PureComponent } from 'react';\nimport T from 'prop-types';\nimport ResizeObserver from 'resize-observer-polyfill';\n\nconst styles = {\n position: 'absolute',\n width: 0,\n height: 0,\n visibility: 'hidden',\n display: 'none',\n};\n\nclass SizeAwareWrapper extends PureComponent {\n constructor(props) {\n super(props);\n this.state = {\n width: null,\n height: null,\n };\n this.animationFrameID = null;\n this.ro = new ResizeObserver(this.handleResize);\n }\n\n componentDidMount() {\n const resizableElement = this.getElement();\n if (resizableElement) {\n this.ro.observe(resizableElement);\n }\n }\n\n componentWillUnmount() {\n const resizableElement = this.getElement();\n if (resizableElement) {\n this.ro.unobserve(resizableElement);\n }\n if (window && this.animationFrameID) {\n window.cancelAnimationFrame(this.animationFrameID);\n }\n }\n\n getElement = () => {\n // it listens on the size of its parent elemnt\n const parentElement = this.el && this.el.parentElement;\n return parentElement;\n };\n\n handleResize = entries => {\n entries.forEach(entry => {\n const { width, height } = entry.contentRect;\n // use requestAnimationFrame to make sure width/height is updated in time\n this.animationFrameID = window.requestAnimationFrame(() => {\n this.setState({ width, height });\n });\n });\n };\n\n renderChildren = () => {\n // expect children to be a function\n const { width, height } = this.state;\n const { children } = this.props;\n if (width != null && height != null && isFunction(children)) {\n return children({ width, height });\n }\n return null;\n };\n\n render() {\n return (\n <React.Fragment>\n <div\n key=\"resize-detector\"\n style={styles}\n ref={el => {\n this.el = el;\n }}\n />\n {this.renderChildren()}\n </React.Fragment>\n );\n }\n}\n\nSizeAwareWrapper.propTypes = {\n children: T.any, // eslint-disable-line react/forbid-prop-types\n};\n\nSizeAwareWrapper.defaultProps = {\n children: null,\n};\n\nexport default SizeAwareWrapper;\n","module.exports = require(\"@babel/runtime/helpers/createClass\");","module.exports = require(\"@babel/runtime/helpers/inherits\");","module.exports = require(\"@babel/runtime/helpers/possibleConstructorReturn\");"],"sourceRoot":""}
|