@splunk/visualizations-shared 28.0.0 → 28.1.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/.eslintrc.json +5 -0
- package/Downloader.js +3 -0
- package/Downloader.js.map +2 -2
- package/FileDownloader.js.map +2 -2
- package/Message.js +10 -41
- package/Message.js.map +4 -4
- package/RemoteIcon.js +23 -46
- package/RemoteIcon.js.map +4 -4
- package/RemoteImage.js +21 -42
- package/RemoteImage.js.map +4 -4
- package/SizeAwareWrapper.js +16 -29
- package/SizeAwareWrapper.js.map +3 -3
- package/VisualizationDocPage.js +34 -88
- package/VisualizationDocPage.js.map +4 -4
- package/package.json +10 -10
- package/SizeAwareWrapperDeprecated.js +0 -145
- package/SizeAwareWrapperDeprecated.js.map +0 -7
package/.eslintrc.json
ADDED
package/Downloader.js
CHANGED
package/Downloader.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["src/Downloader.ts", "esm-externals:@splunk/ui-utils/i18n"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable max-classes-per-file */\n/* eslint-disable class-methods-use-this */\nimport { _ } from '@splunk/ui-utils/i18n';\nimport ImageRegistry from '@splunk/visualization-context/ImageRegistry';\n\nexport interface DownloadProgress {\n bytesDownloaded: number;\n contentLength?: number;\n message: string;\n}\nexport interface IDownloader {\n downloadWithProgress(\n url: string,\n complete: (svg: string) => void,\n progress?: (p: DownloadProgress) => void,\n error?: (msg: string, error?: Error) => void\n ): void;\n}\n\nexport const b64DecodeUnicode = (base64Data: string): string => {\n // from bytestream, to percent-encoding, to original string.\n return decodeURIComponent(\n atob(base64Data)\n .split('')\n .map((c: string): string => {\n return `%${`00${c.charCodeAt(0).toString(16)}`.slice(-2)}`;\n })\n .join('')\n );\n};\n\nexport class ImageRegistryFetcher implements IDownloader {\n context: ImageRegistry;\n\n constructor(context?: ImageRegistry) {\n this.context = context;\n }\n\n async downloadWithProgress(\n url: string,\n complete: (svg: string) => void,\n progress?: (p: DownloadProgress) => void,\n error?: (msg: string, error?: Error) => void\n ): Promise<void> {\n const imageRegistry = this.context;\n if (!imageRegistry) {\n error(_('Missing Image Context'));\n }\n try {\n const imageData = await imageRegistry.getByURL(url);\n const [mime, svgBase64] = imageData.dataURI.split('base64,');\n if (mime && mime.toLowerCase().indexOf('image/svg+xml') > -1) {\n complete(b64DecodeUnicode(svgBase64));\n } else {\n error(_(`Unsupported MIME type ${mime} for url ${url}`));\n }\n } catch (e) {\n error(_(`Error retrieving ${url} from Image Registry, error was '${e.message}'`), e);\n }\n }\n}\n\nexport class URLDownloader implements IDownloader {\n downloadWithProgress(\n url: string,\n complete: (svg: string) => void,\n progress?: (p: DownloadProgress) => void,\n error?: (msg: string, error?: Error) => void\n ): void {\n // Step 1: fetch content from URL, get reader\n fetch(url)\n .then(async (response: Response): Promise<void> => {\n if (!response.ok) {\n const msg = `Fetch not Ok for ${url}, status was '${response.statusText}'`;\n // eslint-disable-next-line no-console\n console.warn(msg);\n error(msg);\n return;\n }\n const reader = response.body.getReader();\n\n // Step 2: get total length\n const contentLength = +response.headers.get('Content-Length');\n\n // Step 3: read the data\n let bytesDownloaded = 0; // length at the moment\n const chunks = []; // array of received binary chunks (comprises the body)\n let done = false;\n while (!done) {\n // eslint-disable-next-line no-await-in-loop\n const res = await reader.read();\n done = res.done;\n const { value } = res;\n if (value) {\n chunks.push(value);\n bytesDownloaded += value.length;\n progress({\n // call the progress callback...can enable the UI to show progress\n bytesDownloaded,\n contentLength,\n message: `Received ${bytesDownloaded} bytes of ${\n contentLength || 'unknown size'\n }`,\n });\n }\n }\n\n // Step 4: concatenate chunks into single Uint8Array\n const chunksAll = new Uint8Array(bytesDownloaded);\n let position = 0;\n // eslint-disable-next-line no-restricted-syntax\n for (const chunk of chunks) {\n chunksAll.set(chunk, position);\n position += chunk.length;\n }\n\n progress({\n bytesDownloaded,\n contentLength,\n message: 'decoding chunks',\n });\n\n // Step 5: decode into a string\n const svg = new TextDecoder('utf-8').decode(chunksAll);\n complete(svg); // show the downloaded svg back to the caller via its completion callback\n })\n .catch((e: Error): void => {\n // Note: For CORS issue, fetch api call immediately fails without any status code or response and the error message says \"Failed to fetch\"\n // but for other issues (invalid url, not found, etc), it returns with a certain status code (406, 404, etc)\n // and empty response so further operation on the response data fails.\n const stringifiedError = e.toString();\n // eslint-disable-next-line no-console\n console.error(stringifiedError);\n // call the supplied error handling function\n if (stringifiedError.includes('Failed to fetch')) {\n error(\n `Cannot fetch the image \"${url}\" due to a cross-origin resource sharing (CORS) policy`,\n e\n );\n } else {\n error(`Fetch error for '${url}', error was '${e.toString()}'`, e);\n }\n });\n }\n}\n\nexport default class Downloader {\n private downloaders = {};\n\n constructor(downloaders: { [protocol: string]: IDownloader }) {\n this.downloaders = downloaders;\n }\n\n downloadWithProgress(\n url: string,\n complete: (svg: string) => void,\n progress?: (p: DownloadProgress) => void,\n error?: (msg: string, error?: Error) => void\n ): void {\n // url is the following:\n // data:image/svg+xml;base64....\n // http://\n // https://\n // local://\n // or otherwise return errors\n\n let protocol = '';\n let isUrl = true;\n try {\n protocol = new URL(url).protocol;\n } catch (e) {\n isUrl = false;\n }\n\n if (isUrl) {\n try {\n const [type = ''] = protocol.split(':');\n if (this.downloaders[type]) {\n // data, http(s), local....\n this.downloaders[type].downloadWithProgress(url, complete, progress, error);\n } else {\n // unknown type\n error(`Unsupported URL protocol '${type}' for SVG download: ${url}`);\n }\n } catch (e) {\n error(`Unexpected error downloading SVG: ${e.message}`);\n }\n } else {\n // the url might be literal content. <svg>...</svg>. This is kindof a hack where if you pass the downloader something\n // that is literal content, it will just return the content. Makes the code flow cleaner in layers above.\n complete(url);\n }\n }\n}\n", "\nimport * as defaultImport from \"@splunk/ui-utils/i18n\";\nexport * from \"@splunk/ui-utils/i18n\";\nexport default ('default' in defaultImport ? defaultImport.default : defaultImport);\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;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AA,EAG5B,YAAY,aAAkD;AAF9D,SAAQ,cAAc,CAAC;AAGnB,SAAK,cAAc;AAAA,EACvB;AAAA,EAEA,qBACI,KACA,UACA,UACA,OACI;AAQJ,QAAI,WAAW;AACf,QAAI,QAAQ;AACZ,QAAI;AACA,iBAAW,IAAI,IAAI,GAAG,EAAE;AAAA,IAC5B,SAAS,GAAG;AACR,cAAQ;AAAA,IACZ;AAEA,QAAI,OAAO;AACP,UAAI;AACA,cAAM,CAAC,OAAO,EAAE,IAAI,SAAS,MAAM,GAAG;AACtC,YAAI,KAAK,YAAY,IAAI,GAAG;AAExB,eAAK,YAAY,IAAI,EAAE,qBAAqB,KAAK,UAAU,UAAU,KAAK;AAAA,QAC9E,OAAO;AAEH,gBAAM,6BAA6B,IAAI,uBAAuB,GAAG,EAAE;AAAA,QACvE;AAAA,MACJ,SAAS,GAAG;AACR,cAAM,qCAAqC,EAAE,OAAO,EAAE;AAAA,MAC1D;AAAA,IACJ,OAAO;AAGH,eAAS,GAAG;AAAA,IAChB;AAAA,EACJ;AACJ;",
|
|
4
|
+
"sourcesContent": ["/* eslint-disable max-classes-per-file */\n/* eslint-disable class-methods-use-this */\nimport { _ } from '@splunk/ui-utils/i18n';\nimport ImageRegistry from '@splunk/visualization-context/ImageRegistry';\n\nexport interface DownloadProgress {\n bytesDownloaded: number;\n contentLength?: number;\n message: string;\n}\nexport interface IDownloader {\n downloadWithProgress(\n url: string,\n complete: (svg: string) => void,\n progress?: (p: DownloadProgress) => void,\n error?: (msg: string, error?: Error) => void\n ): void;\n}\n\nexport const b64DecodeUnicode = (base64Data: string): string => {\n // from bytestream, to percent-encoding, to original string.\n return decodeURIComponent(\n atob(base64Data)\n .split('')\n .map((c: string): string => {\n return `%${`00${c.charCodeAt(0).toString(16)}`.slice(-2)}`;\n })\n .join('')\n );\n};\n\nexport class ImageRegistryFetcher implements IDownloader {\n context: ImageRegistry;\n\n constructor(context?: ImageRegistry) {\n this.context = context;\n }\n\n async downloadWithProgress(\n url: string,\n complete: (svg: string) => void,\n progress?: (p: DownloadProgress) => void,\n error?: (msg: string, error?: Error) => void\n ): Promise<void> {\n const imageRegistry = this.context;\n if (!imageRegistry) {\n error(_('Missing Image Context'));\n }\n try {\n const imageData = await imageRegistry.getByURL(url);\n const [mime, svgBase64] = imageData.dataURI.split('base64,');\n if (mime && mime.toLowerCase().indexOf('image/svg+xml') > -1) {\n complete(b64DecodeUnicode(svgBase64));\n } else {\n error(_(`Unsupported MIME type ${mime} for url ${url}`));\n }\n } catch (e) {\n error(_(`Error retrieving ${url} from Image Registry, error was '${e.message}'`), e);\n }\n }\n}\n\nexport class URLDownloader implements IDownloader {\n downloadWithProgress(\n url: string,\n complete: (svg: string) => void,\n progress?: (p: DownloadProgress) => void,\n error?: (msg: string, error?: Error) => void\n ): void {\n // Step 1: fetch content from URL, get reader\n fetch(url)\n .then(async (response: Response): Promise<void> => {\n if (!response.ok) {\n const msg = `Fetch not Ok for ${url}, status was '${response.statusText}'`;\n // eslint-disable-next-line no-console\n console.warn(msg);\n error(msg);\n return;\n }\n const reader = response.body.getReader();\n\n // Step 2: get total length\n const contentLength = +response.headers.get('Content-Length');\n\n // Step 3: read the data\n let bytesDownloaded = 0; // length at the moment\n const chunks = []; // array of received binary chunks (comprises the body)\n let done = false;\n while (!done) {\n // eslint-disable-next-line no-await-in-loop\n const res = await reader.read();\n if (!res) {\n return;\n }\n done = res.done;\n const { value } = res;\n if (value) {\n chunks.push(value);\n bytesDownloaded += value.length;\n progress({\n // call the progress callback...can enable the UI to show progress\n bytesDownloaded,\n contentLength,\n message: `Received ${bytesDownloaded} bytes of ${\n contentLength || 'unknown size'\n }`,\n });\n }\n }\n\n // Step 4: concatenate chunks into single Uint8Array\n const chunksAll = new Uint8Array(bytesDownloaded);\n let position = 0;\n // eslint-disable-next-line no-restricted-syntax\n for (const chunk of chunks) {\n chunksAll.set(chunk, position);\n position += chunk.length;\n }\n\n progress({\n bytesDownloaded,\n contentLength,\n message: 'decoding chunks',\n });\n\n // Step 5: decode into a string\n const svg = new TextDecoder('utf-8').decode(chunksAll);\n complete(svg); // show the downloaded svg back to the caller via its completion callback\n })\n .catch((e: Error): void => {\n // Note: For CORS issue, fetch api call immediately fails without any status code or response and the error message says \"Failed to fetch\"\n // but for other issues (invalid url, not found, etc), it returns with a certain status code (406, 404, etc)\n // and empty response so further operation on the response data fails.\n const stringifiedError = e.toString();\n // eslint-disable-next-line no-console\n console.error(stringifiedError);\n // call the supplied error handling function\n if (stringifiedError.includes('Failed to fetch')) {\n error(\n `Cannot fetch the image \"${url}\" due to a cross-origin resource sharing (CORS) policy`,\n e\n );\n } else {\n error(`Fetch error for '${url}', error was '${e.toString()}'`, e);\n }\n });\n }\n}\n\nexport default class Downloader {\n private downloaders = {};\n\n constructor(downloaders: { [protocol: string]: IDownloader }) {\n this.downloaders = downloaders;\n }\n\n downloadWithProgress(\n url: string,\n complete: (svg: string) => void,\n progress?: (p: DownloadProgress) => void,\n error?: (msg: string, error?: Error) => void\n ): void {\n // url is the following:\n // data:image/svg+xml;base64....\n // http://\n // https://\n // local://\n // or otherwise return errors\n\n let protocol = '';\n let isUrl = true;\n try {\n protocol = new URL(url).protocol;\n } catch (e) {\n isUrl = false;\n }\n\n if (isUrl) {\n try {\n const [type = ''] = protocol.split(':');\n if (this.downloaders[type]) {\n // data, http(s), local....\n this.downloaders[type].downloadWithProgress(url, complete, progress, error);\n } else {\n // unknown type\n error(`Unsupported URL protocol '${type}' for SVG download: ${url}`);\n }\n } catch (e) {\n error(`Unexpected error downloading SVG: ${e.message}`);\n }\n } else {\n // the url might be literal content. <svg>...</svg>. This is kindof a hack where if you pass the downloader something\n // that is literal content, it will just return the content. Makes the code flow cleaner in layers above.\n complete(url);\n }\n }\n}\n", "\nimport * as defaultImport from \"@splunk/ui-utils/i18n\";\nexport * from \"@splunk/ui-utils/i18n\";\nexport default ('default' in defaultImport ? defaultImport.default : defaultImport);\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;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AACJ;AAEA,IAAqB,aAArB,MAAgC;AAAA,EAG5B,YAAY,aAAkD;AAF9D,SAAQ,cAAc,CAAC;AAGnB,SAAK,cAAc;AAAA,EACvB;AAAA,EAEA,qBACI,KACA,UACA,UACA,OACI;AAQJ,QAAI,WAAW;AACf,QAAI,QAAQ;AACZ,QAAI;AACA,iBAAW,IAAI,IAAI,GAAG,EAAE;AAAA,IAC5B,SAAS,GAAG;AACR,cAAQ;AAAA,IACZ;AAEA,QAAI,OAAO;AACP,UAAI;AACA,cAAM,CAAC,OAAO,EAAE,IAAI,SAAS,MAAM,GAAG;AACtC,YAAI,KAAK,YAAY,IAAI,GAAG;AAExB,eAAK,YAAY,IAAI,EAAE,qBAAqB,KAAK,UAAU,UAAU,KAAK;AAAA,QAC9E,OAAO;AAEH,gBAAM,6BAA6B,IAAI,uBAAuB,GAAG,EAAE;AAAA,QACvE;AAAA,MACJ,SAAS,GAAG;AACR,cAAM,qCAAqC,EAAE,OAAO,EAAE;AAAA,MAC1D;AAAA,IACJ,OAAO;AAGH,eAAS,GAAG;AAAA,IAChB;AAAA,EACJ;AACJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/FileDownloader.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["src/FileDownloader.tsx", "esm-externals:react", "esm-externals:@splunk/ui-utils/i18n", "src/Downloader.ts"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nimport Downloader, { IDownloader, DownloadProgress } from './Downloader';\n\nexport interface FileDownloaderProps {\n /**\n * The URL to download\n */\n url: string;\n /**\n * The render function that will render when the content is downloaded\n * @returns {JSX.Element}\n */\n renderContent: (content: string) => JSX.Element;\n /**\n * An optional function to render progress (defaults to basic text display of progress)\n * @param {DownloadProgress} progress\n * @returns {JSX.Element}\n */\n renderProgress?: (progress: DownloadProgress) => JSX.Element;\n /**\n * An optional function to render errors (defaults to basic text display of errors)\n * @param {string} msg\n * @param {Error} error\n * @returns {JSX.Element}\n */\n renderError?: (msg: string, error?: Error) => JSX.Element;\n /**\n * A <key>:<Downloader> map for Downloader Component\n */\n protocolHandlers: { [key: string]: IDownloader };\n}\n\nexport const FileDownloader = (props: FileDownloaderProps): JSX.Element => {\n const [content, setContent] = React.useState<string>();\n const [progress, setProgress] = React.useState<DownloadProgress>({\n message: `Downloading ${props.url}...`,\n bytesDownloaded: 0,\n });\n const [error, setError] = React.useState<string>();\n const {\n url,\n renderContent,\n renderProgress,\n renderError = (msg: string): JSX.Element => <div>{msg}</div>,\n } = props;\n React.useEffect(() => {\n const downloader = new Downloader(props.protocolHandlers);\n downloader.downloadWithProgress(\n url,\n complete => setContent(complete), // done downloading\n (currentProgress: DownloadProgress): void => {\n setProgress(currentProgress);\n },\n (msg: string): void => {\n setError(msg);\n }\n );\n }, [props.protocolHandlers, url]);\n if (content) {\n return renderContent(content);\n }\n if (error) {\n return renderError(error);\n }\n return typeof renderProgress === 'function' ? renderProgress(progress) : null;\n};\n", "\nimport * as defaultImport from \"react\";\nexport * from \"react\";\nexport default ('default' in defaultImport ? defaultImport.default : defaultImport);\n", "\nimport * as defaultImport from \"@splunk/ui-utils/i18n\";\nexport * from \"@splunk/ui-utils/i18n\";\nexport default ('default' in defaultImport ? defaultImport.default : defaultImport);\n", "/* eslint-disable max-classes-per-file */\n/* eslint-disable class-methods-use-this */\nimport { _ } from '@splunk/ui-utils/i18n';\nimport ImageRegistry from '@splunk/visualization-context/ImageRegistry';\n\nexport interface DownloadProgress {\n bytesDownloaded: number;\n contentLength?: number;\n message: string;\n}\nexport interface IDownloader {\n downloadWithProgress(\n url: string,\n complete: (svg: string) => void,\n progress?: (p: DownloadProgress) => void,\n error?: (msg: string, error?: Error) => void\n ): void;\n}\n\nexport const b64DecodeUnicode = (base64Data: string): string => {\n // from bytestream, to percent-encoding, to original string.\n return decodeURIComponent(\n atob(base64Data)\n .split('')\n .map((c: string): string => {\n return `%${`00${c.charCodeAt(0).toString(16)}`.slice(-2)}`;\n })\n .join('')\n );\n};\n\nexport class ImageRegistryFetcher implements IDownloader {\n context: ImageRegistry;\n\n constructor(context?: ImageRegistry) {\n this.context = context;\n }\n\n async downloadWithProgress(\n url: string,\n complete: (svg: string) => void,\n progress?: (p: DownloadProgress) => void,\n error?: (msg: string, error?: Error) => void\n ): Promise<void> {\n const imageRegistry = this.context;\n if (!imageRegistry) {\n error(_('Missing Image Context'));\n }\n try {\n const imageData = await imageRegistry.getByURL(url);\n const [mime, svgBase64] = imageData.dataURI.split('base64,');\n if (mime && mime.toLowerCase().indexOf('image/svg+xml') > -1) {\n complete(b64DecodeUnicode(svgBase64));\n } else {\n error(_(`Unsupported MIME type ${mime} for url ${url}`));\n }\n } catch (e) {\n error(_(`Error retrieving ${url} from Image Registry, error was '${e.message}'`), e);\n }\n }\n}\n\nexport class URLDownloader implements IDownloader {\n downloadWithProgress(\n url: string,\n complete: (svg: string) => void,\n progress?: (p: DownloadProgress) => void,\n error?: (msg: string, error?: Error) => void\n ): void {\n // Step 1: fetch content from URL, get reader\n fetch(url)\n .then(async (response: Response): Promise<void> => {\n if (!response.ok) {\n const msg = `Fetch not Ok for ${url}, status was '${response.statusText}'`;\n // eslint-disable-next-line no-console\n console.warn(msg);\n error(msg);\n return;\n }\n const reader = response.body.getReader();\n\n // Step 2: get total length\n const contentLength = +response.headers.get('Content-Length');\n\n // Step 3: read the data\n let bytesDownloaded = 0; // length at the moment\n const chunks = []; // array of received binary chunks (comprises the body)\n let done = false;\n while (!done) {\n // eslint-disable-next-line no-await-in-loop\n const res = await reader.read();\n done = res.done;\n const { value } = res;\n if (value) {\n chunks.push(value);\n bytesDownloaded += value.length;\n progress({\n // call the progress callback...can enable the UI to show progress\n bytesDownloaded,\n contentLength,\n message: `Received ${bytesDownloaded} bytes of ${\n contentLength || 'unknown size'\n }`,\n });\n }\n }\n\n // Step 4: concatenate chunks into single Uint8Array\n const chunksAll = new Uint8Array(bytesDownloaded);\n let position = 0;\n // eslint-disable-next-line no-restricted-syntax\n for (const chunk of chunks) {\n chunksAll.set(chunk, position);\n position += chunk.length;\n }\n\n progress({\n bytesDownloaded,\n contentLength,\n message: 'decoding chunks',\n });\n\n // Step 5: decode into a string\n const svg = new TextDecoder('utf-8').decode(chunksAll);\n complete(svg); // show the downloaded svg back to the caller via its completion callback\n })\n .catch((e: Error): void => {\n // Note: For CORS issue, fetch api call immediately fails without any status code or response and the error message says \"Failed to fetch\"\n // but for other issues (invalid url, not found, etc), it returns with a certain status code (406, 404, etc)\n // and empty response so further operation on the response data fails.\n const stringifiedError = e.toString();\n // eslint-disable-next-line no-console\n console.error(stringifiedError);\n // call the supplied error handling function\n if (stringifiedError.includes('Failed to fetch')) {\n error(\n `Cannot fetch the image \"${url}\" due to a cross-origin resource sharing (CORS) policy`,\n e\n );\n } else {\n error(`Fetch error for '${url}', error was '${e.toString()}'`, e);\n }\n });\n }\n}\n\nexport default class Downloader {\n private downloaders = {};\n\n constructor(downloaders: { [protocol: string]: IDownloader }) {\n this.downloaders = downloaders;\n }\n\n downloadWithProgress(\n url: string,\n complete: (svg: string) => void,\n progress?: (p: DownloadProgress) => void,\n error?: (msg: string, error?: Error) => void\n ): void {\n // url is the following:\n // data:image/svg+xml;base64....\n // http://\n // https://\n // local://\n // or otherwise return errors\n\n let protocol = '';\n let isUrl = true;\n try {\n protocol = new URL(url).protocol;\n } catch (e) {\n isUrl = false;\n }\n\n if (isUrl) {\n try {\n const [type = ''] = protocol.split(':');\n if (this.downloaders[type]) {\n // data, http(s), local....\n this.downloaders[type].downloadWithProgress(url, complete, progress, error);\n } else {\n // unknown type\n error(`Unsupported URL protocol '${type}' for SVG download: ${url}`);\n }\n } catch (e) {\n error(`Unexpected error downloading SVG: ${e.message}`);\n }\n } else {\n // the url might be literal content. <svg>...</svg>. This is kindof a hack where if you pass the downloader something\n // that is literal content, it will just return the content. Makes the code flow cleaner in layers above.\n complete(url);\n }\n }\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AACA,oBAA+B;AAC/B,0BAAc;AACd,IAAO,gBAAS,aAAa,gBAA8B,wBAAU;;;ACHrE;AAAA;AAAA;AAAA;AACA,IAAAA,iBAA+B;AAC/B,yBAAc;AACd,IAAO,eAAS,aAAaA,iBAA8B,yBAAUA;;;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nimport Downloader, { IDownloader, DownloadProgress } from './Downloader';\n\nexport interface FileDownloaderProps {\n /**\n * The URL to download\n */\n url: string;\n /**\n * The render function that will render when the content is downloaded\n * @returns {JSX.Element}\n */\n renderContent: (content: string) => JSX.Element;\n /**\n * An optional function to render progress (defaults to basic text display of progress)\n * @param {DownloadProgress} progress\n * @returns {JSX.Element}\n */\n renderProgress?: (progress: DownloadProgress) => JSX.Element;\n /**\n * An optional function to render errors (defaults to basic text display of errors)\n * @param {string} msg\n * @param {Error} error\n * @returns {JSX.Element}\n */\n renderError?: (msg: string, error?: Error) => JSX.Element;\n /**\n * A <key>:<Downloader> map for Downloader Component\n */\n protocolHandlers: { [key: string]: IDownloader };\n}\n\nexport const FileDownloader = (props: FileDownloaderProps): JSX.Element => {\n const [content, setContent] = React.useState<string>();\n const [progress, setProgress] = React.useState<DownloadProgress>({\n message: `Downloading ${props.url}...`,\n bytesDownloaded: 0,\n });\n const [error, setError] = React.useState<string>();\n const {\n url,\n renderContent,\n renderProgress,\n renderError = (msg: string): JSX.Element => <div>{msg}</div>,\n } = props;\n React.useEffect(() => {\n const downloader = new Downloader(props.protocolHandlers);\n downloader.downloadWithProgress(\n url,\n complete => setContent(complete), // done downloading\n (currentProgress: DownloadProgress): void => {\n setProgress(currentProgress);\n },\n (msg: string): void => {\n setError(msg);\n }\n );\n }, [props.protocolHandlers, url]);\n if (content) {\n return renderContent(content);\n }\n if (error) {\n return renderError(error);\n }\n return typeof renderProgress === 'function' ? renderProgress(progress) : null;\n};\n", "\nimport * as defaultImport from \"react\";\nexport * from \"react\";\nexport default ('default' in defaultImport ? defaultImport.default : defaultImport);\n", "\nimport * as defaultImport from \"@splunk/ui-utils/i18n\";\nexport * from \"@splunk/ui-utils/i18n\";\nexport default ('default' in defaultImport ? defaultImport.default : defaultImport);\n", "/* eslint-disable max-classes-per-file */\n/* eslint-disable class-methods-use-this */\nimport { _ } from '@splunk/ui-utils/i18n';\nimport ImageRegistry from '@splunk/visualization-context/ImageRegistry';\n\nexport interface DownloadProgress {\n bytesDownloaded: number;\n contentLength?: number;\n message: string;\n}\nexport interface IDownloader {\n downloadWithProgress(\n url: string,\n complete: (svg: string) => void,\n progress?: (p: DownloadProgress) => void,\n error?: (msg: string, error?: Error) => void\n ): void;\n}\n\nexport const b64DecodeUnicode = (base64Data: string): string => {\n // from bytestream, to percent-encoding, to original string.\n return decodeURIComponent(\n atob(base64Data)\n .split('')\n .map((c: string): string => {\n return `%${`00${c.charCodeAt(0).toString(16)}`.slice(-2)}`;\n })\n .join('')\n );\n};\n\nexport class ImageRegistryFetcher implements IDownloader {\n context: ImageRegistry;\n\n constructor(context?: ImageRegistry) {\n this.context = context;\n }\n\n async downloadWithProgress(\n url: string,\n complete: (svg: string) => void,\n progress?: (p: DownloadProgress) => void,\n error?: (msg: string, error?: Error) => void\n ): Promise<void> {\n const imageRegistry = this.context;\n if (!imageRegistry) {\n error(_('Missing Image Context'));\n }\n try {\n const imageData = await imageRegistry.getByURL(url);\n const [mime, svgBase64] = imageData.dataURI.split('base64,');\n if (mime && mime.toLowerCase().indexOf('image/svg+xml') > -1) {\n complete(b64DecodeUnicode(svgBase64));\n } else {\n error(_(`Unsupported MIME type ${mime} for url ${url}`));\n }\n } catch (e) {\n error(_(`Error retrieving ${url} from Image Registry, error was '${e.message}'`), e);\n }\n }\n}\n\nexport class URLDownloader implements IDownloader {\n downloadWithProgress(\n url: string,\n complete: (svg: string) => void,\n progress?: (p: DownloadProgress) => void,\n error?: (msg: string, error?: Error) => void\n ): void {\n // Step 1: fetch content from URL, get reader\n fetch(url)\n .then(async (response: Response): Promise<void> => {\n if (!response.ok) {\n const msg = `Fetch not Ok for ${url}, status was '${response.statusText}'`;\n // eslint-disable-next-line no-console\n console.warn(msg);\n error(msg);\n return;\n }\n const reader = response.body.getReader();\n\n // Step 2: get total length\n const contentLength = +response.headers.get('Content-Length');\n\n // Step 3: read the data\n let bytesDownloaded = 0; // length at the moment\n const chunks = []; // array of received binary chunks (comprises the body)\n let done = false;\n while (!done) {\n // eslint-disable-next-line no-await-in-loop\n const res = await reader.read();\n if (!res) {\n return;\n }\n done = res.done;\n const { value } = res;\n if (value) {\n chunks.push(value);\n bytesDownloaded += value.length;\n progress({\n // call the progress callback...can enable the UI to show progress\n bytesDownloaded,\n contentLength,\n message: `Received ${bytesDownloaded} bytes of ${\n contentLength || 'unknown size'\n }`,\n });\n }\n }\n\n // Step 4: concatenate chunks into single Uint8Array\n const chunksAll = new Uint8Array(bytesDownloaded);\n let position = 0;\n // eslint-disable-next-line no-restricted-syntax\n for (const chunk of chunks) {\n chunksAll.set(chunk, position);\n position += chunk.length;\n }\n\n progress({\n bytesDownloaded,\n contentLength,\n message: 'decoding chunks',\n });\n\n // Step 5: decode into a string\n const svg = new TextDecoder('utf-8').decode(chunksAll);\n complete(svg); // show the downloaded svg back to the caller via its completion callback\n })\n .catch((e: Error): void => {\n // Note: For CORS issue, fetch api call immediately fails without any status code or response and the error message says \"Failed to fetch\"\n // but for other issues (invalid url, not found, etc), it returns with a certain status code (406, 404, etc)\n // and empty response so further operation on the response data fails.\n const stringifiedError = e.toString();\n // eslint-disable-next-line no-console\n console.error(stringifiedError);\n // call the supplied error handling function\n if (stringifiedError.includes('Failed to fetch')) {\n error(\n `Cannot fetch the image \"${url}\" due to a cross-origin resource sharing (CORS) policy`,\n e\n );\n } else {\n error(`Fetch error for '${url}', error was '${e.toString()}'`, e);\n }\n });\n }\n}\n\nexport default class Downloader {\n private downloaders = {};\n\n constructor(downloaders: { [protocol: string]: IDownloader }) {\n this.downloaders = downloaders;\n }\n\n downloadWithProgress(\n url: string,\n complete: (svg: string) => void,\n progress?: (p: DownloadProgress) => void,\n error?: (msg: string, error?: Error) => void\n ): void {\n // url is the following:\n // data:image/svg+xml;base64....\n // http://\n // https://\n // local://\n // or otherwise return errors\n\n let protocol = '';\n let isUrl = true;\n try {\n protocol = new URL(url).protocol;\n } catch (e) {\n isUrl = false;\n }\n\n if (isUrl) {\n try {\n const [type = ''] = protocol.split(':');\n if (this.downloaders[type]) {\n // data, http(s), local....\n this.downloaders[type].downloadWithProgress(url, complete, progress, error);\n } else {\n // unknown type\n error(`Unsupported URL protocol '${type}' for SVG download: ${url}`);\n }\n } catch (e) {\n error(`Unexpected error downloading SVG: ${e.message}`);\n }\n } else {\n // the url might be literal content. <svg>...</svg>. This is kindof a hack where if you pass the downloader something\n // that is literal content, it will just return the content. Makes the code flow cleaner in layers above.\n complete(url);\n }\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AACA,oBAA+B;AAC/B,0BAAc;AACd,IAAO,gBAAS,aAAa,gBAA8B,wBAAU;;;ACHrE;AAAA;AAAA;AAAA;AACA,IAAAA,iBAA+B;AAC/B,yBAAc;AACd,IAAO,eAAS,aAAaA,iBAA8B,yBAAUA;;;ACkJrE,IAAqB,aAArB,MAAgC;AAAA,EAG5B,YAAY,aAAkD;AAF9D,SAAQ,cAAc,CAAC;AAGnB,SAAK,cAAc;AAAA,EACvB;AAAA,EAEA,qBACI,KACA,UACA,UACA,OACI;AAQJ,QAAI,WAAW;AACf,QAAI,QAAQ;AACZ,QAAI;AACA,iBAAW,IAAI,IAAI,GAAG,EAAE;AAAA,IAC5B,SAAS,GAAG;AACR,cAAQ;AAAA,IACZ;AAEA,QAAI,OAAO;AACP,UAAI;AACA,cAAM,CAAC,OAAO,EAA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HANGED
|
@@ -30,7 +30,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
30
30
|
));
|
|
31
31
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
32
|
|
|
33
|
-
// src/Message.
|
|
33
|
+
// src/Message.tsx
|
|
34
34
|
var Message_exports2 = {};
|
|
35
35
|
__export(Message_exports2, {
|
|
36
36
|
default: () => Message_default2
|
|
@@ -46,41 +46,32 @@ var defaultImport = __toESM(require("react"));
|
|
|
46
46
|
__reExport(react_exports, require("react"));
|
|
47
47
|
var react_default = "default" in defaultImport ? defaultImport.default : defaultImport;
|
|
48
48
|
|
|
49
|
-
// esm-externals:prop-types
|
|
50
|
-
var prop_types_exports = {};
|
|
51
|
-
__export(prop_types_exports, {
|
|
52
|
-
default: () => prop_types_default
|
|
53
|
-
});
|
|
54
|
-
var defaultImport2 = __toESM(require("prop-types"));
|
|
55
|
-
__reExport(prop_types_exports, require("prop-types"));
|
|
56
|
-
var prop_types_default = "default" in defaultImport2 ? defaultImport2.default : defaultImport2;
|
|
57
|
-
|
|
58
49
|
// esm-externals:styled-components
|
|
59
50
|
var styled_components_exports = {};
|
|
60
51
|
__export(styled_components_exports, {
|
|
61
52
|
default: () => styled_components_default
|
|
62
53
|
});
|
|
63
|
-
var
|
|
54
|
+
var defaultImport2 = __toESM(require("styled-components"));
|
|
64
55
|
__reExport(styled_components_exports, require("styled-components"));
|
|
65
|
-
var styled_components_default = "default" in
|
|
56
|
+
var styled_components_default = "default" in defaultImport2 ? defaultImport2.default : defaultImport2;
|
|
66
57
|
|
|
67
58
|
// esm-externals:@splunk/react-ui/Message
|
|
68
59
|
var Message_exports = {};
|
|
69
60
|
__export(Message_exports, {
|
|
70
61
|
default: () => Message_default
|
|
71
62
|
});
|
|
72
|
-
var
|
|
63
|
+
var defaultImport3 = __toESM(require("@splunk/react-ui/Message"));
|
|
73
64
|
__reExport(Message_exports, require("@splunk/react-ui/Message"));
|
|
74
|
-
var Message_default = "default" in
|
|
65
|
+
var Message_default = "default" in defaultImport3 ? defaultImport3.default : defaultImport3;
|
|
75
66
|
|
|
76
67
|
// esm-externals:lodash/isNumber
|
|
77
68
|
var isNumber_exports = {};
|
|
78
69
|
__export(isNumber_exports, {
|
|
79
70
|
default: () => isNumber_default
|
|
80
71
|
});
|
|
81
|
-
var
|
|
72
|
+
var defaultImport4 = __toESM(require("lodash/isNumber"));
|
|
82
73
|
__reExport(isNumber_exports, require("lodash/isNumber"));
|
|
83
|
-
var isNumber_default = "default" in
|
|
74
|
+
var isNumber_default = "default" in defaultImport4 ? defaultImport4.default : defaultImport4;
|
|
84
75
|
|
|
85
76
|
// src/style.js
|
|
86
77
|
var toPx = (number, defaultNumber = 0) => isNumber_default(number) ? `${number}px` : number || toPx(defaultNumber);
|
|
@@ -95,7 +86,7 @@ var toDimension = ({ width, height }) => {
|
|
|
95
86
|
return css;
|
|
96
87
|
};
|
|
97
88
|
|
|
98
|
-
// src/Message.
|
|
89
|
+
// src/Message.tsx
|
|
99
90
|
var MessageContainer = styled_components_default.div`
|
|
100
91
|
overflow: hidden;
|
|
101
92
|
display: flex;
|
|
@@ -103,28 +94,6 @@ var MessageContainer = styled_components_default.div`
|
|
|
103
94
|
align-items: center;
|
|
104
95
|
${(p) => toDimension({ width: p.width, height: p.height })};
|
|
105
96
|
`;
|
|
106
|
-
var Message = ({ width, height, level, message }) => /* @__PURE__ */
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* width in pixel or string, defaults to 100%
|
|
110
|
-
*/
|
|
111
|
-
width: prop_types_default.oneOfType([prop_types_default.string, prop_types_default.number]),
|
|
112
|
-
/**
|
|
113
|
-
* height in pixel or string
|
|
114
|
-
*/
|
|
115
|
-
height: prop_types_default.oneOfType([prop_types_default.string, prop_types_default.number]),
|
|
116
|
-
/**
|
|
117
|
-
* message text
|
|
118
|
-
*/
|
|
119
|
-
message: prop_types_default.string,
|
|
120
|
-
/**
|
|
121
|
-
* message level
|
|
122
|
-
*/
|
|
123
|
-
level: prop_types_default.oneOf(["info", "warning", "error"])
|
|
124
|
-
};
|
|
125
|
-
Message.defaultProps = {
|
|
126
|
-
level: "info",
|
|
127
|
-
message: ""
|
|
128
|
-
};
|
|
129
|
-
var Message_default2 = react_default.memo(Message);
|
|
97
|
+
var Message = ({ width, height, level = "info", message = "" }) => /* @__PURE__ */ react_exports.createElement(MessageContainer, { width, height, "data-test": "visualization-message" }, /* @__PURE__ */ react_exports.createElement(Message_default, { type: level, style: { maxWidth: "100%" } }, message));
|
|
98
|
+
var Message_default2 = react_exports.memo(Message);
|
|
130
99
|
//# sourceMappingURL=Message.js.map
|
package/Message.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["src/Message.
|
|
4
|
-
"sourcesContent": ["import React from 'react';\nimport
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,mBAAA;AAAA,SAAAA,kBAAA;AAAA,iBAAAC;AAAA;AAAA,8BAAAD;;;ACAA;AAAA;AAAA;AAAA;AACA,oBAA+B;AAC/B,0BAAc;AACd,IAAO,gBAAS,aAAa,gBAA8B,wBAAU;;;ACHrE;AAAA;AAAA;AAAA;AACA,IAAAE,iBAA+B;AAC/B
|
|
6
|
-
"names": ["Message_exports", "Message_default", "defaultImport", "defaultImport", "defaultImport", "
|
|
3
|
+
"sources": ["src/Message.tsx", "esm-externals:react", "esm-externals:styled-components", "esm-externals:@splunk/react-ui/Message", "esm-externals:lodash/isNumber", "src/style.js"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nimport styled from 'styled-components';\nimport SplunkUIMessage from '@splunk/react-ui/Message';\nimport { toDimension } from './style';\n\nconst MessageContainer = styled.div<{ width: string | number; height: string | number }>`\n overflow: hidden;\n display: flex;\n justify-content: center;\n align-items: center;\n ${p => toDimension({ width: p.width, height: p.height })};\n`;\n\ntype MessageProps = {\n width: string | number;\n height: string | number;\n level: 'info' | 'warning' | 'error';\n message: string;\n};\n\nconst Message = ({ width, height, level = 'info', message = '' }: MessageProps) => (\n <MessageContainer width={width} height={height} data-test=\"visualization-message\">\n <SplunkUIMessage type={level} style={{ maxWidth: '100%' }}>\n {message}\n </SplunkUIMessage>\n </MessageContainer>\n);\n\nexport default React.memo(Message);\n", "\nimport * as defaultImport from \"react\";\nexport * from \"react\";\nexport default ('default' in defaultImport ? defaultImport.default : defaultImport);\n", "\nimport * as defaultImport from \"styled-components\";\nexport * from \"styled-components\";\nexport default ('default' in defaultImport ? defaultImport.default : defaultImport);\n", "\nimport * as defaultImport from \"@splunk/react-ui/Message\";\nexport * from \"@splunk/react-ui/Message\";\nexport default ('default' in defaultImport ? defaultImport.default : defaultImport);\n", "\nimport * as defaultImport from \"lodash/isNumber\";\nexport * from \"lodash/isNumber\";\nexport default ('default' in defaultImport ? defaultImport.default : defaultImport);\n", "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, 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,UAAU,OAAO,KACnD,OACL,CACJ;AAGJ,IAAOC,mBAAc,mBAAK,OAAO;",
|
|
6
|
+
"names": ["Message_exports", "Message_default", "defaultImport", "defaultImport", "defaultImport", "Message_default"]
|
|
7
7
|
}
|
package/RemoteIcon.js
CHANGED
|
@@ -7,7 +7,6 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
7
7
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
8
|
var __getProtoOf = Object.getPrototypeOf;
|
|
9
9
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
11
10
|
var __export = (target, all) => {
|
|
12
11
|
for (var name in all)
|
|
13
12
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -30,7 +29,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
30
29
|
mod
|
|
31
30
|
));
|
|
32
31
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
33
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
34
32
|
var __async = (__this, __arguments, generator) => {
|
|
35
33
|
return new Promise((resolve, reject) => {
|
|
36
34
|
var fulfilled = (value) => {
|
|
@@ -52,7 +50,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
52
50
|
});
|
|
53
51
|
};
|
|
54
52
|
|
|
55
|
-
// src/RemoteIcon.
|
|
53
|
+
// src/RemoteIcon.tsx
|
|
56
54
|
var RemoteIcon_exports = {};
|
|
57
55
|
__export(RemoteIcon_exports, {
|
|
58
56
|
default: () => RemoteIcon_default
|
|
@@ -68,59 +66,50 @@ var defaultImport = __toESM(require("react"));
|
|
|
68
66
|
__reExport(react_exports, require("react"));
|
|
69
67
|
var react_default = "default" in defaultImport ? defaultImport.default : defaultImport;
|
|
70
68
|
|
|
71
|
-
// esm-externals:prop-types
|
|
72
|
-
var prop_types_exports = {};
|
|
73
|
-
__export(prop_types_exports, {
|
|
74
|
-
default: () => prop_types_default
|
|
75
|
-
});
|
|
76
|
-
var defaultImport2 = __toESM(require("prop-types"));
|
|
77
|
-
__reExport(prop_types_exports, require("prop-types"));
|
|
78
|
-
var prop_types_default = "default" in defaultImport2 ? defaultImport2.default : defaultImport2;
|
|
79
|
-
|
|
80
69
|
// esm-externals:styled-components
|
|
81
70
|
var styled_components_exports = {};
|
|
82
71
|
__export(styled_components_exports, {
|
|
83
72
|
default: () => styled_components_default
|
|
84
73
|
});
|
|
85
|
-
var
|
|
74
|
+
var defaultImport2 = __toESM(require("styled-components"));
|
|
86
75
|
__reExport(styled_components_exports, require("styled-components"));
|
|
87
|
-
var styled_components_default = "default" in
|
|
76
|
+
var styled_components_default = "default" in defaultImport2 ? defaultImport2.default : defaultImport2;
|
|
88
77
|
|
|
89
78
|
// esm-externals:xmlserializer
|
|
90
79
|
var xmlserializer_exports = {};
|
|
91
80
|
__export(xmlserializer_exports, {
|
|
92
81
|
default: () => xmlserializer_default
|
|
93
82
|
});
|
|
94
|
-
var
|
|
83
|
+
var defaultImport3 = __toESM(require("xmlserializer"));
|
|
95
84
|
__reExport(xmlserializer_exports, require("xmlserializer"));
|
|
96
|
-
var xmlserializer_default = "default" in
|
|
85
|
+
var xmlserializer_default = "default" in defaultImport3 ? defaultImport3.default : defaultImport3;
|
|
97
86
|
|
|
98
87
|
// esm-externals:@splunk/ui-utils/i18n
|
|
99
88
|
var i18n_exports = {};
|
|
100
89
|
__export(i18n_exports, {
|
|
101
90
|
default: () => i18n_default
|
|
102
91
|
});
|
|
103
|
-
var
|
|
92
|
+
var defaultImport4 = __toESM(require("@splunk/ui-utils/i18n"));
|
|
104
93
|
__reExport(i18n_exports, require("@splunk/ui-utils/i18n"));
|
|
105
|
-
var i18n_default = "default" in
|
|
94
|
+
var i18n_default = "default" in defaultImport4 ? defaultImport4.default : defaultImport4;
|
|
106
95
|
|
|
107
96
|
// esm-externals:@splunk/visualization-context/IconContext
|
|
108
97
|
var IconContext_exports = {};
|
|
109
98
|
__export(IconContext_exports, {
|
|
110
99
|
default: () => IconContext_default
|
|
111
100
|
});
|
|
112
|
-
var
|
|
101
|
+
var defaultImport5 = __toESM(require("@splunk/visualization-context/IconContext"));
|
|
113
102
|
__reExport(IconContext_exports, require("@splunk/visualization-context/IconContext"));
|
|
114
|
-
var IconContext_default = "default" in
|
|
103
|
+
var IconContext_default = "default" in defaultImport5 ? defaultImport5.default : defaultImport5;
|
|
115
104
|
|
|
116
105
|
// esm-externals:lodash/isNumber
|
|
117
106
|
var isNumber_exports = {};
|
|
118
107
|
__export(isNumber_exports, {
|
|
119
108
|
default: () => isNumber_default
|
|
120
109
|
});
|
|
121
|
-
var
|
|
110
|
+
var defaultImport6 = __toESM(require("lodash/isNumber"));
|
|
122
111
|
__reExport(isNumber_exports, require("lodash/isNumber"));
|
|
123
|
-
var isNumber_default = "default" in
|
|
112
|
+
var isNumber_default = "default" in defaultImport6 ? defaultImport6.default : defaultImport6;
|
|
124
113
|
|
|
125
114
|
// src/style.js
|
|
126
115
|
var toPx = (number, defaultNumber = 0) => isNumber_default(number) ? `${number}px` : number || toPx(defaultNumber);
|
|
@@ -156,7 +145,7 @@ var b64EncodeUnicode = (str) => (
|
|
|
156
145
|
btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, (match, p1) => String.fromCharCode(`0x${p1}`)))
|
|
157
146
|
);
|
|
158
147
|
|
|
159
|
-
// src/RemoteIcon.
|
|
148
|
+
// src/RemoteIcon.tsx
|
|
160
149
|
var IconContainer = styled_components_default.div`
|
|
161
150
|
${(props) => toDimension({ width: props.width, height: props.height })};
|
|
162
151
|
margin: auto;
|
|
@@ -234,18 +223,18 @@ var _RemoteIcon = class _RemoteIcon extends react_exports.PureComponent {
|
|
|
234
223
|
*/
|
|
235
224
|
colorIcon(dataURI, color) {
|
|
236
225
|
fetch(dataURI).then((response) => response.text()).then((text) => {
|
|
226
|
+
var _a, _b;
|
|
237
227
|
const parser = new DOMParser();
|
|
238
228
|
const xmlDoc = parser.parseFromString(text, "text/xml");
|
|
239
229
|
const svg = xmlDoc.getElementsByTagName("svg")[0];
|
|
240
230
|
const children = svg.querySelectorAll("*");
|
|
241
231
|
svg.style.color = color;
|
|
242
|
-
for (
|
|
243
|
-
const child = children[i];
|
|
232
|
+
for (const child of children) {
|
|
244
233
|
if (_RemoteIcon.BASIC_SHAPES.includes(child.tagName)) {
|
|
245
234
|
const fillAttr = child.getAttribute("fill");
|
|
246
|
-
const fillStyle = child.style
|
|
235
|
+
const fillStyle = (_a = child.style) == null ? void 0 : _a.fill;
|
|
247
236
|
const strokeAttr = child.getAttribute("stroke");
|
|
248
|
-
const strokeStyle = child.style
|
|
237
|
+
const strokeStyle = (_b = child.style) == null ? void 0 : _b.stroke;
|
|
249
238
|
if (shouldChangeFill({
|
|
250
239
|
fillAttr,
|
|
251
240
|
fillStyle,
|
|
@@ -266,7 +255,8 @@ var _RemoteIcon = class _RemoteIcon extends react_exports.PureComponent {
|
|
|
266
255
|
}
|
|
267
256
|
}
|
|
268
257
|
}
|
|
269
|
-
const
|
|
258
|
+
const s = xmlserializer_exports.serializeToString(svg);
|
|
259
|
+
const svgStr = b64EncodeUnicode(s);
|
|
270
260
|
const iconDataURI = `data:image/svg+xml;base64,${svgStr}`;
|
|
271
261
|
this.setState({ iconDataURI });
|
|
272
262
|
}).catch(() => {
|
|
@@ -275,15 +265,15 @@ var _RemoteIcon = class _RemoteIcon extends react_exports.PureComponent {
|
|
|
275
265
|
}
|
|
276
266
|
render() {
|
|
277
267
|
const { iconDataURI } = this.state;
|
|
278
|
-
const { width, height, opacity, onIconClick } = this.props;
|
|
268
|
+
const { alt = (0, i18n_exports._)("Remote Icon"), width = 100, height = 100, opacity = 1, onIconClick } = this.props;
|
|
279
269
|
if (!iconDataURI) {
|
|
280
270
|
return null;
|
|
281
271
|
}
|
|
282
|
-
return /* @__PURE__ */
|
|
272
|
+
return /* @__PURE__ */ react_exports.createElement(IconContainer, { width, height, onClick: onIconClick }, /* @__PURE__ */ react_exports.createElement(
|
|
283
273
|
ColoredIcon,
|
|
284
274
|
{
|
|
285
275
|
src: iconDataURI,
|
|
286
|
-
alt
|
|
276
|
+
alt,
|
|
287
277
|
width,
|
|
288
278
|
height,
|
|
289
279
|
opacity,
|
|
@@ -292,21 +282,8 @@ var _RemoteIcon = class _RemoteIcon extends react_exports.PureComponent {
|
|
|
292
282
|
));
|
|
293
283
|
}
|
|
294
284
|
};
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
iconURL: prop_types_default.string,
|
|
298
|
-
color: prop_types_default.string,
|
|
299
|
-
width: prop_types_default.number,
|
|
300
|
-
height: prop_types_default.number,
|
|
301
|
-
opacity: prop_types_default.number,
|
|
302
|
-
onIconClick: prop_types_default.func
|
|
303
|
-
});
|
|
304
|
-
__publicField(_RemoteIcon, "defaultProps", {
|
|
305
|
-
width: 100,
|
|
306
|
-
height: 100,
|
|
307
|
-
opacity: 1
|
|
308
|
-
});
|
|
309
|
-
__publicField(_RemoteIcon, "BASIC_SHAPES", ["path", "rect", "circle", "ellipse", "line", "polyline", "polygon"]);
|
|
285
|
+
_RemoteIcon.contextType = IconContext_default;
|
|
286
|
+
_RemoteIcon.BASIC_SHAPES = ["path", "rect", "circle", "ellipse", "line", "polyline", "polygon"];
|
|
310
287
|
var RemoteIcon = _RemoteIcon;
|
|
311
288
|
var RemoteIcon_default = RemoteIcon;
|
|
312
289
|
//# sourceMappingURL=RemoteIcon.js.map
|
package/RemoteIcon.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["src/RemoteIcon.
|
|
4
|
-
"sourcesContent": ["/* 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 (\n shouldChangeFill({\n fillAttr,\n fillStyle,\n strokeAttr,\n strokeStyle,\n })\n ) {\n child.style.fill = '';\n child.setAttribute('fill', 'currentColor');\n }\n\n if (\n shouldChangeStroke({\n fillAttr,\n fillStyle,\n strokeAttr,\n strokeStyle,\n })\n ) {\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", "\nimport * as defaultImport from \"react\";\nexport * from \"react\";\nexport default ('default' in defaultImport ? defaultImport.default : defaultImport);\n", "\nimport * as defaultImport from \"prop-types\";\nexport * from \"prop-types\";\nexport default ('default' in defaultImport ? defaultImport.default : defaultImport);\n", "\nimport * as defaultImport from \"styled-components\";\nexport * from \"styled-components\";\nexport default ('default' in defaultImport ? defaultImport.default : defaultImport);\n", "\nimport * as defaultImport from \"xmlserializer\";\nexport * from \"xmlserializer\";\nexport default ('default' in defaultImport ? defaultImport.default : defaultImport);\n", "\nimport * as defaultImport from \"@splunk/ui-utils/i18n\";\nexport * from \"@splunk/ui-utils/i18n\";\nexport default ('default' in defaultImport ? defaultImport.default : defaultImport);\n", "\nimport * as defaultImport from \"@splunk/visualization-context/IconContext\";\nexport * from \"@splunk/visualization-context/IconContext\";\nexport default ('default' in defaultImport ? defaultImport.default : defaultImport);\n", "\nimport * as defaultImport from \"lodash/isNumber\";\nexport * from \"lodash/isNumber\";\nexport default ('default' in defaultImport ? defaultImport.default : defaultImport);\n", "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", "/**\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"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["defaultImport", "defaultImport", "defaultImport", "defaultImport", "defaultImport"
|
|
3
|
+
"sources": ["src/RemoteIcon.tsx", "esm-externals:react", "esm-externals:styled-components", "esm-externals:xmlserializer", "esm-externals:@splunk/ui-utils/i18n", "esm-externals:@splunk/visualization-context/IconContext", "esm-externals:lodash/isNumber", "src/style.js", "src/iconUtils.js"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable class-methods-use-this */\nimport * as React from 'react';\nimport styled from 'styled-components';\nimport * as 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\ninterface RemoteIconProps {\n alt?: string;\n iconURL?: string;\n color?: string;\n width?: number;\n height?: number;\n opacity?: number;\n onIconClick?: (event: React.MouseEvent<HTMLDivElement>) => void;\n}\n\ninterface RemoteIconState {\n iconDataURI: string | null;\n}\n\nconst IconContainer = styled.div<RemoteIconProps>`\n ${props => toDimension({ width: props.width, height: props.height })};\n margin: auto;\n cursor: ${props => (props.onClick ? 'pointer' : 'inherit')};\n`;\n\nconst ColoredIcon = styled.img<RemoteIconProps>`\n ${props => toDimension({ width: props.width, height: props.height })};\n opacity: ${props => props.opacity || 1.0};\n`;\n\nclass RemoteIcon extends React.PureComponent<RemoteIconProps, RemoteIconState> {\n static readonly contextType: IconContext = IconContext;\n\n static readonly BASIC_SHAPES = ['path', 'rect', 'circle', 'ellipse', 'line', 'polyline', 'polygon'];\n\n constructor(props: RemoteIconProps) {\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: IconContext = this.context;\n if (iconRegistry) {\n try {\n const icon = (await iconRegistry.getByURL(iconURL)) as any;\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 // eslint-disable-next-line no-restricted-syntax\n for (const child of children) {\n if (RemoteIcon.BASIC_SHAPES.includes(child.tagName)) {\n const fillAttr = child.getAttribute('fill');\n const fillStyle = (child as SVGElement).style?.fill;\n const strokeAttr = child.getAttribute('stroke');\n const strokeStyle = (child as SVGElement).style?.stroke;\n if (\n shouldChangeFill({\n fillAttr,\n fillStyle,\n strokeAttr,\n strokeStyle,\n })\n ) {\n (child as SVGElement).style.fill = '';\n child.setAttribute('fill', 'currentColor');\n }\n\n if (\n shouldChangeStroke({\n fillAttr,\n fillStyle,\n strokeAttr,\n strokeStyle,\n })\n ) {\n (child as SVGElement).style.stroke = '';\n child.setAttribute('stroke', 'currentColor');\n }\n }\n }\n const s = xmlserializer.serializeToString(svg);\n const svgStr = b64EncodeUnicode(s);\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 { alt = _('Remote Icon'), width = 100, height = 100, opacity = 1.0, onIconClick } = this.props;\n if (!iconDataURI) {\n return null;\n }\n return (\n <IconContainer width={width} height={height} onClick={onIconClick}>\n <ColoredIcon\n src={iconDataURI}\n alt={alt}\n width={width}\n height={height}\n opacity={opacity}\n referrerPolicy=\"no-referrer\"\n />\n </IconContainer>\n );\n }\n}\n\nexport default RemoteIcon;\n", "\nimport * as defaultImport from \"react\";\nexport * from \"react\";\nexport default ('default' in defaultImport ? defaultImport.default : defaultImport);\n", "\nimport * as defaultImport from \"styled-components\";\nexport * from \"styled-components\";\nexport default ('default' in defaultImport ? defaultImport.default : defaultImport);\n", "\nimport * as defaultImport from \"xmlserializer\";\nexport * from \"xmlserializer\";\nexport default ('default' in defaultImport ? defaultImport.default : defaultImport);\n", "\nimport * as defaultImport from \"@splunk/ui-utils/i18n\";\nexport * from \"@splunk/ui-utils/i18n\";\nexport default ('default' in defaultImport ? defaultImport.default : defaultImport);\n", "\nimport * as defaultImport from \"@splunk/visualization-context/IconContext\";\nexport * from \"@splunk/visualization-context/IconContext\";\nexport default ('default' in defaultImport ? defaultImport.default : defaultImport);\n", "\nimport * as defaultImport from \"lodash/isNumber\";\nexport * from \"lodash/isNumber\";\nexport default ('default' in defaultImport ? defaultImport.default : defaultImport);\n", "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", "/**\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"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;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