react-svg 17.2.0 → 17.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -27,25 +27,25 @@ root.render(<ReactSVG src="svg.svg" />)
27
27
 
28
28
  ## Live Examples
29
29
 
30
- - Accessibility: [Source](https://github.com/tanem/react-svg/tree/master/examples/accessibility) | [Sandbox](https://codesandbox.io/s/github/tanem/react-svg/tree/master/examples/accessibility)
31
- - API Usage: [Source](https://github.com/tanem/react-svg/tree/master/examples/api-usage) | [Sandbox](https://codesandbox.io/s/github/tanem/react-svg/tree/master/examples/api-usage)
32
- - Basic Usage: [Source](https://github.com/tanem/react-svg/tree/master/examples/basic-usage) | [Sandbox](https://codesandbox.io/s/github/tanem/react-svg/tree/master/examples/basic-usage)
33
- - Before Injection: [Source](https://github.com/tanem/react-svg/tree/master/examples/before-injection) | [Sandbox](https://codesandbox.io/s/github/tanem/react-svg/tree/master/examples/before-injection)
34
- - CSS Animation: [Source](https://github.com/tanem/react-svg/tree/master/examples/css-animation) | [Sandbox](https://codesandbox.io/s/github/tanem/react-svg/tree/master/examples/css-animation)
35
- - CSS-in-JS: [Source](https://github.com/tanem/react-svg/tree/master/examples/css-in-js) | [Sandbox](https://codesandbox.io/s/github/tanem/react-svg/tree/master/examples/css-in-js)
36
- - Data URL: [Source](https://github.com/tanem/react-svg/tree/master/examples/data-url) | [Sandbox](https://codesandbox.io/s/github/tanem/react-svg/tree/master/examples/data-url)
37
- - External Stylesheet: [Source](https://github.com/tanem/react-svg/tree/master/examples/external-stylesheet) | [Sandbox](https://codesandbox.io/s/github/tanem/react-svg/tree/master/examples/external-stylesheet)
38
- - Fallbacks: [Source](https://github.com/tanem/react-svg/tree/master/examples/fallbacks) | [Sandbox](https://codesandbox.io/s/github/tanem/react-svg/tree/master/examples/fallbacks)
39
- - Iframe: [Source](https://github.com/tanem/react-svg/tree/master/examples/iframe) | [Sandbox](https://codesandbox.io/s/github/tanem/react-svg/tree/master/examples/iframe)
40
- - Loading: [Source](https://github.com/tanem/react-svg/tree/master/examples/loading) | [Sandbox](https://codesandbox.io/s/github/tanem/react-svg/tree/master/examples/loading)
41
- - No Extension: [Source](https://github.com/tanem/react-svg/tree/master/examples/no-extension) | [Sandbox](https://codesandbox.io/s/github/tanem/react-svg/tree/master/examples/no-extension)
42
- - Sprite Usage: [Source](https://github.com/tanem/react-svg/tree/master/examples/sprite-usage) | [Sandbox](https://codesandbox.io/s/github/tanem/react-svg/tree/master/examples/sprite-usage)
43
- - SSR: [Source](https://github.com/tanem/react-svg/tree/master/examples/ssr) | [Sandbox](https://codesandbox.io/s/github/tanem/react-svg/tree/master/examples/ssr)
44
- - Styled Components: [Source](https://github.com/tanem/react-svg/tree/master/examples/styled-components) | [Sandbox](https://codesandbox.io/s/github/tanem/react-svg/tree/master/examples/styled-components)
45
- - SVG Wrapper: [Source](https://github.com/tanem/react-svg/tree/master/examples/svg-wrapper) | [Sandbox](https://codesandbox.io/s/github/tanem/react-svg/tree/master/examples/svg-wrapper)
46
- - Typescript: [Source](https://github.com/tanem/react-svg/tree/master/examples/typescript) | [Sandbox](https://codesandbox.io/s/github/tanem/react-svg/tree/master/examples/typescript)
47
- - UMD Build (Development): [Source](https://github.com/tanem/react-svg/tree/master/examples/umd-dev) | [Sandbox](https://codesandbox.io/s/github/tanem/react-svg/tree/master/examples/umd-dev)
48
- - UMD Build (Production): [Source](https://github.com/tanem/react-svg/tree/master/examples/umd-prod) | [Sandbox](https://codesandbox.io/s/github/tanem/react-svg/tree/master/examples/umd-prod)
30
+ - Accessibility: [Source](https://github.com/tanem/react-svg/tree/master/examples/accessibility) | [Sandbox](https://codesandbox.io/p/devbox/github/tanem/react-svg/tree/master/examples/accessibility)
31
+ - API Usage: [Source](https://github.com/tanem/react-svg/tree/master/examples/api-usage) | [Sandbox](https://codesandbox.io/p/devbox/github/tanem/react-svg/tree/master/examples/api-usage)
32
+ - Basic Usage: [Source](https://github.com/tanem/react-svg/tree/master/examples/basic-usage) | [Sandbox](https://codesandbox.io/p/devbox/github/tanem/react-svg/tree/master/examples/basic-usage)
33
+ - Before Injection: [Source](https://github.com/tanem/react-svg/tree/master/examples/before-injection) | [Sandbox](https://codesandbox.io/p/devbox/github/tanem/react-svg/tree/master/examples/before-injection)
34
+ - CSS Animation: [Source](https://github.com/tanem/react-svg/tree/master/examples/css-animation) | [Sandbox](https://codesandbox.io/p/devbox/github/tanem/react-svg/tree/master/examples/css-animation)
35
+ - CSS-in-JS: [Source](https://github.com/tanem/react-svg/tree/master/examples/css-in-js) | [Sandbox](https://codesandbox.io/p/devbox/github/tanem/react-svg/tree/master/examples/css-in-js)
36
+ - Data URL: [Source](https://github.com/tanem/react-svg/tree/master/examples/data-url) | [Sandbox](https://codesandbox.io/p/devbox/github/tanem/react-svg/tree/master/examples/data-url)
37
+ - External Stylesheet: [Source](https://github.com/tanem/react-svg/tree/master/examples/external-stylesheet) | [Sandbox](https://codesandbox.io/p/devbox/github/tanem/react-svg/tree/master/examples/external-stylesheet)
38
+ - Fallbacks: [Source](https://github.com/tanem/react-svg/tree/master/examples/fallbacks) | [Sandbox](https://codesandbox.io/p/devbox/github/tanem/react-svg/tree/master/examples/fallbacks)
39
+ - Iframe: [Source](https://github.com/tanem/react-svg/tree/master/examples/iframe) | [Sandbox](https://codesandbox.io/p/devbox/github/tanem/react-svg/tree/master/examples/iframe)
40
+ - Loading: [Source](https://github.com/tanem/react-svg/tree/master/examples/loading) | [Sandbox](https://codesandbox.io/p/devbox/github/tanem/react-svg/tree/master/examples/loading)
41
+ - No Extension: [Source](https://github.com/tanem/react-svg/tree/master/examples/no-extension) | [Sandbox](https://codesandbox.io/p/devbox/github/tanem/react-svg/tree/master/examples/no-extension)
42
+ - Sprite Usage: [Source](https://github.com/tanem/react-svg/tree/master/examples/sprite-usage) | [Sandbox](https://codesandbox.io/p/devbox/github/tanem/react-svg/tree/master/examples/sprite-usage)
43
+ - SSR: [Source](https://github.com/tanem/react-svg/tree/master/examples/ssr) | [Sandbox](https://codesandbox.io/p/devbox/github/tanem/react-svg/tree/master/examples/ssr)
44
+ - Styled Components: [Source](https://github.com/tanem/react-svg/tree/master/examples/styled-components) | [Sandbox](https://codesandbox.io/p/devbox/github/tanem/react-svg/tree/master/examples/styled-components)
45
+ - SVG Wrapper: [Source](https://github.com/tanem/react-svg/tree/master/examples/svg-wrapper) | [Sandbox](https://codesandbox.io/p/devbox/github/tanem/react-svg/tree/master/examples/svg-wrapper)
46
+ - Typescript: [Source](https://github.com/tanem/react-svg/tree/master/examples/typescript) | [Sandbox](https://codesandbox.io/p/devbox/github/tanem/react-svg/tree/master/examples/typescript)
47
+ - UMD Build (Development): [Source](https://github.com/tanem/react-svg/tree/master/examples/umd-dev) | [Sandbox](https://codesandbox.io/p/devbox/github/tanem/react-svg/tree/master/examples/umd-dev)
48
+ - UMD Build (Production): [Source](https://github.com/tanem/react-svg/tree/master/examples/umd-prod) | [Sandbox](https://codesandbox.io/p/devbox/github/tanem/react-svg/tree/master/examples/umd-prod)
49
49
 
50
50
  ## API
51
51
 
@@ -176,7 +176,6 @@ var ReactSVG = /*#__PURE__*/function (_React$Component) {
176
176
  var newDesc = document.createElementNS(svgNamespace, 'desc');
177
177
  newDesc.id = descId;
178
178
  newDesc.textContent = desc;
179
- // Insert after <title> if present, otherwise prepend.
180
179
  var existingTitle = svg.querySelector(':scope > title');
181
180
  if (existingTitle) {
182
181
  existingTitle.after(newDesc);
@@ -1 +1 @@
1
- {"version":3,"file":"react-svg.cjs.development.js","sources":["../compiled/owner-window.js","../compiled/shallow-differs.js","../compiled/ReactSVG.js"],"sourcesContent":["// Hat-tip: https://github.com/mui/material-ui/tree/master/packages/mui-utils/src.\nconst ownerWindow = (node) => {\n const doc = node?.ownerDocument || document;\n return doc.defaultView || window;\n};\nexport default ownerWindow;\n","// Hat-tip: https://github.com/developit/preact-compat/blob/master/src/index.js#L402.\nconst shallowDiffers = (a, b) => {\n for (const i in a) {\n if (!(i in b)) {\n return true;\n }\n }\n for (const i in b) {\n if (a[i] !== b[i]) {\n return true;\n }\n }\n return false;\n};\nexport default shallowDiffers;\n","import { SVGInjector } from '@tanem/svg-injector';\nimport * as PropTypes from 'prop-types';\nimport * as React from 'react';\nimport ownerWindow from './owner-window';\nimport shallowDiffers from './shallow-differs';\nconst svgNamespace = 'http://www.w3.org/2000/svg';\nconst xlinkNamespace = 'http://www.w3.org/1999/xlink';\n// Random prefix avoids ID collisions when multiple copies of react-svg are\n// bundled (e.g. microfrontends). The counter ensures each component instance\n// within the same bundle gets a unique ID.\nconst idPrefix = `react-svg-${Math.random().toString(36).slice(2, 6)}`;\nlet idCounter = 0;\nexport class ReactSVG extends React.Component {\n static defaultProps = {\n afterInjection: () => undefined,\n beforeInjection: () => undefined,\n desc: '',\n evalScripts: 'never',\n fallback: null,\n httpRequestWithCredentials: false,\n loading: null,\n onError: () => undefined,\n renumerateIRIElements: true,\n title: '',\n useRequestCache: true,\n wrapper: 'div',\n };\n static propTypes = {\n afterInjection: PropTypes.func,\n beforeInjection: PropTypes.func,\n desc: PropTypes.string,\n evalScripts: PropTypes.oneOf(['always', 'once', 'never']),\n fallback: PropTypes.oneOfType([\n PropTypes.func,\n PropTypes.object,\n PropTypes.string,\n ]),\n httpRequestWithCredentials: PropTypes.bool,\n loading: PropTypes.oneOfType([\n PropTypes.func,\n PropTypes.object,\n PropTypes.string,\n ]),\n onError: PropTypes.func,\n renumerateIRIElements: PropTypes.bool,\n src: PropTypes.string.isRequired,\n title: PropTypes.string,\n useRequestCache: PropTypes.bool,\n wrapper: PropTypes.oneOf(['div', 'span', 'svg']),\n };\n initialState = {\n hasError: false,\n isLoading: true,\n };\n state = this.initialState;\n _isMounted = false;\n reactWrapper;\n nonReactWrapper;\n refCallback = (reactWrapper) => {\n this.reactWrapper = reactWrapper;\n };\n renderSVG() {\n /* istanbul ignore else */\n if (this.reactWrapper instanceof ownerWindow(this.reactWrapper).Node) {\n const { desc, evalScripts, httpRequestWithCredentials, renumerateIRIElements, src, title, useRequestCache, } = this.props;\n const onError = this.props.onError;\n const beforeInjection = this.props.beforeInjection;\n const afterInjection = this.props.afterInjection;\n const wrapper = this.props.wrapper;\n let nonReactWrapper;\n let nonReactTarget;\n if (wrapper === 'svg') {\n nonReactWrapper = document.createElementNS(svgNamespace, wrapper);\n nonReactWrapper.setAttribute('xmlns', svgNamespace);\n nonReactWrapper.setAttribute('xmlns:xlink', xlinkNamespace);\n nonReactTarget = document.createElementNS(svgNamespace, wrapper);\n }\n else {\n nonReactWrapper = document.createElement(wrapper);\n nonReactTarget = document.createElement(wrapper);\n }\n nonReactWrapper.appendChild(nonReactTarget);\n nonReactTarget.dataset.src = src;\n this.nonReactWrapper = this.reactWrapper.appendChild(nonReactWrapper);\n const handleError = (error) => {\n this.removeSVG();\n if (!this._isMounted) {\n onError(error);\n return;\n }\n this.setState(() => ({\n hasError: true,\n isLoading: false,\n }), () => {\n onError(error);\n });\n };\n const afterEach = (error, svg) => {\n if (error) {\n handleError(error);\n return;\n }\n // TODO (Tane): It'd be better to cleanly unsubscribe from SVGInjector\n // callbacks instead of tracking a property like this.\n if (this._isMounted) {\n this.setState(() => ({\n isLoading: false,\n }), () => {\n try {\n afterInjection(svg);\n }\n catch (afterInjectionError) {\n handleError(afterInjectionError);\n }\n });\n }\n };\n // WAI best practice: SVGs need role=\"img\" plus aria-labelledby/\n // aria-describedby pointing to <title>/<desc> element IDs for screen\n // readers to announce them. svg-injector copies the HTML title\n // *attribute* (tooltip) but doesn't create SVG-namespace child\n // elements or ARIA linkage, so we handle that here.\n const beforeEach = (svg) => {\n svg.setAttribute('role', 'img');\n const ariaLabelledBy = [];\n const ariaDescribedBy = [];\n if (title) {\n const originalTitle = svg.querySelector(':scope > title');\n if (originalTitle) {\n svg.removeChild(originalTitle);\n }\n const titleId = `${idPrefix}-title-${++idCounter}`;\n // createElementNS is required: createElement would produce an\n // HTML-namespace node that screen readers ignore inside SVG.\n const newTitle = document.createElementNS(svgNamespace, 'title');\n newTitle.id = titleId;\n newTitle.textContent = title;\n svg.prepend(newTitle);\n ariaLabelledBy.push(titleId);\n }\n if (desc) {\n const originalDesc = svg.querySelector(':scope > desc');\n if (originalDesc) {\n svg.removeChild(originalDesc);\n }\n const descId = `${idPrefix}-desc-${++idCounter}`;\n const newDesc = document.createElementNS(svgNamespace, 'desc');\n newDesc.id = descId;\n newDesc.textContent = desc;\n // Insert after <title> if present, otherwise prepend.\n const existingTitle = svg.querySelector(':scope > title');\n if (existingTitle) {\n existingTitle.after(newDesc);\n }\n else {\n svg.prepend(newDesc);\n }\n ariaDescribedBy.push(descId);\n }\n if (ariaLabelledBy.length > 0) {\n svg.setAttribute('aria-labelledby', ariaLabelledBy.join(' '));\n }\n if (ariaDescribedBy.length > 0) {\n svg.setAttribute('aria-describedby', ariaDescribedBy.join(' '));\n }\n try {\n beforeInjection(svg);\n }\n catch (error) {\n handleError(error);\n }\n };\n SVGInjector(nonReactTarget, {\n afterEach,\n beforeEach,\n cacheRequests: useRequestCache,\n evalScripts,\n httpRequestWithCredentials,\n renumerateIRIElements,\n });\n }\n }\n removeSVG() {\n if (this.nonReactWrapper?.parentNode) {\n this.nonReactWrapper.parentNode.removeChild(this.nonReactWrapper);\n this.nonReactWrapper = null;\n }\n }\n componentDidMount() {\n this._isMounted = true;\n this.renderSVG();\n }\n componentDidUpdate(prevProps) {\n if (shallowDiffers({ ...prevProps }, this.props)) {\n this.setState(() => this.initialState, () => {\n this.removeSVG();\n this.renderSVG();\n });\n }\n }\n componentWillUnmount() {\n this._isMounted = false;\n this.removeSVG();\n }\n render() {\n /* eslint-disable @typescript-eslint/no-unused-vars */\n const { afterInjection, beforeInjection, desc, evalScripts, fallback: Fallback, httpRequestWithCredentials, loading: Loading, renumerateIRIElements, src, title, useRequestCache, wrapper, ...rest } = this.props;\n /* eslint-enable @typescript-eslint/no-unused-vars */\n const Wrapper = wrapper;\n return (React.createElement(Wrapper, { ...rest, ref: this.refCallback, ...(wrapper === 'svg'\n ? {\n xmlns: svgNamespace,\n xmlnsXlink: xlinkNamespace,\n }\n : {}) },\n this.state.isLoading && Loading && React.createElement(Loading, null),\n this.state.hasError && Fallback && React.createElement(Fallback, null)));\n }\n}\n"],"names":["ownerWindow","node","doc","ownerDocument","document","defaultView","window","shallowDiffers","a","b","i","svgNamespace","xlinkNamespace","idPrefix","Math","random","toString","slice","idCounter","ReactSVG","_React$Component","_this","_len","arguments","length","args","Array","_key","call","apply","concat","initialState","hasError","isLoading","state","_isMounted","reactWrapper","nonReactWrapper","refCallback","_inheritsLoose","_proto","prototype","renderSVG","_this2","Node","_this$props","props","desc","evalScripts","httpRequestWithCredentials","renumerateIRIElements","src","title","useRequestCache","onError","beforeInjection","afterInjection","wrapper","nonReactTarget","createElementNS","setAttribute","createElement","appendChild","dataset","handleError","error","removeSVG","setState","afterEach","svg","afterInjectionError","beforeEach","ariaLabelledBy","ariaDescribedBy","originalTitle","querySelector","removeChild","titleId","newTitle","id","textContent","prepend","push","originalDesc","descId","newDesc","existingTitle","after","join","SVGInjector","cacheRequests","_this$nonReactWrapper","parentNode","componentDidMount","componentDidUpdate","prevProps","_this3","_extends","componentWillUnmount","render","_this$props2","Fallback","fallback","Loading","loading","rest","_objectWithoutPropertiesLoose","_excluded","Wrapper","React","ref","xmlns","xmlnsXlink","Component","defaultProps","undefined","propTypes","PropTypes","func","string","oneOf","oneOfType","object","bool","isRequired"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA,IAAMA,WAAW,GAAG,SAAdA,WAAWA,CAAIC,IAAI,EAAK;EAC1B,IAAMC,GAAG,GAAG,CAAAD,IAAI,oBAAJA,IAAI,CAAEE,aAAa,KAAIC,QAAQ;AAC3C,EAAA,OAAOF,GAAG,CAACG,WAAW,IAAIC,MAAM;AACpC,CAAC;;ACJD;AACA,IAAMC,cAAc,GAAG,SAAjBA,cAAcA,CAAIC,CAAC,EAAEC,CAAC,EAAK;AAC7B,EAAA,KAAK,IAAMC,CAAC,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GAAG,EAAEkE,oBAAS,CAACE,MAAM,CAACK,UAAU;EAChCxE,KAAK,EAAEiE,oBAAS,CAACE,MAAM;EACvBlE,eAAe,EAAEgE,oBAAS,CAACM,IAAI;EAC/BlE,OAAO,EAAE4D,oBAAS,CAACG,KAAK,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC;AACnD,CAAC;;;;"}
1
+ {"version":3,"file":"react-svg.cjs.development.js","sources":["../compiled/owner-window.js","../compiled/shallow-differs.js","../compiled/ReactSVG.js"],"sourcesContent":["// Hat-tip: https://github.com/mui/material-ui/tree/master/packages/mui-utils/src.\nconst ownerWindow = (node) => {\n const doc = node?.ownerDocument || document;\n return doc.defaultView || window;\n};\nexport default ownerWindow;\n","// Hat-tip: https://github.com/developit/preact-compat/blob/master/src/index.js#L402.\nconst shallowDiffers = (a, b) => {\n for (const i in a) {\n if (!(i in b)) {\n return true;\n }\n }\n for (const i in b) {\n if (a[i] !== b[i]) {\n return true;\n }\n }\n return false;\n};\nexport default shallowDiffers;\n","import { SVGInjector } from '@tanem/svg-injector';\nimport * as PropTypes from 'prop-types';\nimport * as React from 'react';\nimport ownerWindow from './owner-window';\nimport shallowDiffers from './shallow-differs';\nconst svgNamespace = 'http://www.w3.org/2000/svg';\nconst xlinkNamespace = 'http://www.w3.org/1999/xlink';\n// Random prefix avoids ID collisions when multiple copies of react-svg are\n// bundled (e.g. microfrontends). The counter ensures each component instance\n// within the same bundle gets a unique ID.\nconst idPrefix = `react-svg-${Math.random().toString(36).slice(2, 6)}`;\nlet idCounter = 0;\nexport class ReactSVG extends React.Component {\n static defaultProps = {\n afterInjection: () => undefined,\n beforeInjection: () => undefined,\n desc: '',\n evalScripts: 'never',\n fallback: null,\n httpRequestWithCredentials: false,\n loading: null,\n onError: () => undefined,\n renumerateIRIElements: true,\n title: '',\n useRequestCache: true,\n wrapper: 'div',\n };\n static propTypes = {\n afterInjection: PropTypes.func,\n beforeInjection: PropTypes.func,\n desc: PropTypes.string,\n evalScripts: PropTypes.oneOf(['always', 'once', 'never']),\n fallback: PropTypes.oneOfType([\n PropTypes.func,\n PropTypes.object,\n PropTypes.string,\n ]),\n httpRequestWithCredentials: PropTypes.bool,\n loading: PropTypes.oneOfType([\n PropTypes.func,\n PropTypes.object,\n PropTypes.string,\n ]),\n onError: PropTypes.func,\n renumerateIRIElements: PropTypes.bool,\n src: PropTypes.string.isRequired,\n title: PropTypes.string,\n useRequestCache: PropTypes.bool,\n wrapper: PropTypes.oneOf(['div', 'span', 'svg']),\n };\n initialState = {\n hasError: false,\n isLoading: true,\n };\n state = this.initialState;\n _isMounted = false;\n reactWrapper;\n nonReactWrapper;\n refCallback = (reactWrapper) => {\n this.reactWrapper = reactWrapper;\n };\n renderSVG() {\n /* istanbul ignore else */\n if (this.reactWrapper instanceof ownerWindow(this.reactWrapper).Node) {\n const { desc, evalScripts, httpRequestWithCredentials, renumerateIRIElements, src, title, useRequestCache, } = this.props;\n const onError = this.props.onError;\n const beforeInjection = this.props.beforeInjection;\n const afterInjection = this.props.afterInjection;\n const wrapper = this.props.wrapper;\n let nonReactWrapper;\n let nonReactTarget;\n if (wrapper === 'svg') {\n nonReactWrapper = document.createElementNS(svgNamespace, wrapper);\n nonReactWrapper.setAttribute('xmlns', svgNamespace);\n nonReactWrapper.setAttribute('xmlns:xlink', xlinkNamespace);\n nonReactTarget = document.createElementNS(svgNamespace, wrapper);\n }\n else {\n nonReactWrapper = document.createElement(wrapper);\n nonReactTarget = document.createElement(wrapper);\n }\n nonReactWrapper.appendChild(nonReactTarget);\n nonReactTarget.dataset.src = src;\n this.nonReactWrapper = this.reactWrapper.appendChild(nonReactWrapper);\n const handleError = (error) => {\n this.removeSVG();\n if (!this._isMounted) {\n onError(error);\n return;\n }\n this.setState(() => ({\n hasError: true,\n isLoading: false,\n }), () => {\n onError(error);\n });\n };\n const afterEach = (error, svg) => {\n if (error) {\n handleError(error);\n return;\n }\n // TODO (Tane): It'd be better to cleanly unsubscribe from SVGInjector\n // callbacks instead of tracking a property like this.\n if (this._isMounted) {\n this.setState(() => ({\n isLoading: false,\n }), () => {\n try {\n afterInjection(svg);\n }\n catch (afterInjectionError) {\n handleError(afterInjectionError);\n }\n });\n }\n };\n // WAI best practice: SVGs need role=\"img\" plus aria-labelledby/\n // aria-describedby pointing to <title>/<desc> element IDs for screen\n // readers to announce them. svg-injector copies the HTML title\n // *attribute* (tooltip) but doesn't create SVG-namespace child\n // elements or ARIA linkage, so we handle that here.\n const beforeEach = (svg) => {\n svg.setAttribute('role', 'img');\n const ariaLabelledBy = [];\n const ariaDescribedBy = [];\n if (title) {\n const originalTitle = svg.querySelector(':scope > title');\n if (originalTitle) {\n svg.removeChild(originalTitle);\n }\n const titleId = `${idPrefix}-title-${++idCounter}`;\n // createElementNS is required: createElement would produce an\n // HTML-namespace node that screen readers ignore inside SVG.\n const newTitle = document.createElementNS(svgNamespace, 'title');\n newTitle.id = titleId;\n newTitle.textContent = title;\n svg.prepend(newTitle);\n ariaLabelledBy.push(titleId);\n }\n if (desc) {\n const originalDesc = svg.querySelector(':scope > desc');\n if (originalDesc) {\n svg.removeChild(originalDesc);\n }\n const descId = `${idPrefix}-desc-${++idCounter}`;\n const newDesc = document.createElementNS(svgNamespace, 'desc');\n newDesc.id = descId;\n newDesc.textContent = desc;\n const existingTitle = svg.querySelector(':scope > title');\n if (existingTitle) {\n existingTitle.after(newDesc);\n }\n else {\n svg.prepend(newDesc);\n }\n ariaDescribedBy.push(descId);\n }\n if (ariaLabelledBy.length > 0) {\n svg.setAttribute('aria-labelledby', ariaLabelledBy.join(' '));\n }\n if (ariaDescribedBy.length > 0) {\n svg.setAttribute('aria-describedby', ariaDescribedBy.join(' '));\n }\n try {\n beforeInjection(svg);\n }\n catch (error) {\n handleError(error);\n }\n };\n SVGInjector(nonReactTarget, {\n afterEach,\n beforeEach,\n cacheRequests: useRequestCache,\n evalScripts,\n httpRequestWithCredentials,\n renumerateIRIElements,\n });\n }\n }\n removeSVG() {\n if (this.nonReactWrapper?.parentNode) {\n this.nonReactWrapper.parentNode.removeChild(this.nonReactWrapper);\n this.nonReactWrapper = null;\n }\n }\n componentDidMount() {\n this._isMounted = true;\n this.renderSVG();\n }\n componentDidUpdate(prevProps) {\n if (shallowDiffers({ ...prevProps }, this.props)) {\n this.setState(() => this.initialState, () => {\n this.removeSVG();\n this.renderSVG();\n });\n }\n }\n componentWillUnmount() {\n this._isMounted = false;\n this.removeSVG();\n }\n render() {\n /* eslint-disable @typescript-eslint/no-unused-vars */\n const { afterInjection, beforeInjection, desc, evalScripts, fallback: Fallback, httpRequestWithCredentials, loading: Loading, renumerateIRIElements, src, title, useRequestCache, wrapper, ...rest } = this.props;\n /* eslint-enable @typescript-eslint/no-unused-vars */\n const Wrapper = wrapper;\n return (React.createElement(Wrapper, { ...rest, ref: this.refCallback, ...(wrapper === 'svg'\n ? {\n xmlns: svgNamespace,\n xmlnsXlink: xlinkNamespace,\n }\n : {}) },\n this.state.isLoading && Loading && React.createElement(Loading, null),\n this.state.hasError && Fallback && React.createElement(Fallback, null)));\n }\n}\n"],"names":["ownerWindow","node","doc","ownerDocument","document","defaultView","window","shallowDiffers","a","b","i","svgNamespace","xlinkNamespace","idPrefix","Math","random","toString","slice","idCounter","ReactSVG","_React$Component","_this","_len","arguments","length","args","Array","_key","call","apply","concat","initialState","hasError","isLoading","state","_isMounted","reactWrapper","nonReactWrapper","refCallback","_inheritsLoose","_proto","prototype","renderSVG","_this2","Node","_this$props","props","desc","evalScripts","httpRequestWithCredentials","renumerateIRIElements","src","title","useRequestCache","onError","beforeInjection","afterInjection","wrapper","nonReactTarget","createElementNS","setAttribute","createElement","appendChild","dataset","handleError","error","removeSVG","setState","afterEach","svg","afterInjectionError","beforeEach","ariaLabelledBy","ariaDescribedBy","originalTitle","querySelector","removeChild","titleId","newTitle","id","textContent","prepend","push","originalDesc","descId","newDesc","existingTitle","after","join","SVGInjector","cacheRequests","_this$nonReactWrapper","parentNode","componentDidMount","componentDidUpdate","prevProps","_this3","_extends","componentWillUnmount","render","_this$props2","Fallback","fallback","Loading","loading","rest","_objectWithoutPropertiesLoose","_excluded","Wrapper","React","ref","xmlns","xmlnsXlink","Component","defaultProps","undefined","propTypes","PropTypes","func","string","oneOf","oneOfType","object","bool","isRequired"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA,IAAMA,WAAW,GAAG,SAAdA,WAAWA,CAAIC,IAAI,EAAK;EAC1B,IAAMC,GAAG,GAAG,CAAAD,IAAI,oBAAJA,IAAI,CAAEE,aAAa,KAAIC,QAAQ;AAC3C,EAAA,OAAOF,GAAG,CAACG,WAAW,IAAIC,MAAM;AACpC,CAAC;;ACJD;AACA,IAAMC,cAAc,GAAG,SAAjBA,cAAcA,CAAIC,CAAC,EAAEC,CAAC,EAAK;AAC7B,EAAA,KAAK,IAAMC,CAAC,IAAIF,CAAC,EAAE;AACf,IAAA,IAAI,EAAEE,CAAC,IAAID,CAAC,CAAC,EAAE;AACX,MAAA,OAAO,IAAI;AACf,IAAA;AACJ,EAAA;AACA,EAAA,KAAK,IAAMC,EAAC,IAAID,CAAC,EAAE;IACf,IAAID,CAAC,CAACE,EAAC,CAAC,KAAKD,CAAC,CAACC,EAAC,CAAC,EAAE;AACf,MAAA,OAAO,IAAI;AACf,IAAA;AACJ,EAAA;AACA,EAAA,OAAO,KAAK;AAChB,CAAC;;;ACRD,IAAMC,YAAY,GAAG,4BAA4B;AACjD,IAAMC,cAAc,GAAG,8BAA8B;AACrD;AACA;AACA;AACA,IAAMC,QAAQ,GAAA,YAAA,GAAgBC,IAAI,CAACC,MAAM,EAAE,CAACC,QAAQ,CAAC,EAAE,CAAC,CAACC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAG;AACtE,IAAIC,SAAS,GAAG,CAAC;AACjB,IAAaC,QAAQ,0BAAAC,gBAAA,EAAA;AAAA,EAAA,SAAAD,QAAAA,GAAA;AAAA,IAAA,IAAAE,KAAA;AAAA,IAAA,KAAA,IAAAC,IAAA,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EAAEqE,oBAAS,CAACG,KAAK,CAAC,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;AACzDlB,EAAAA,QAAQ,EAAEe,oBAAS,CAACI,SAAS,CAAC,CAC1BJ,oBAAS,CAACC,IAAI,EACdD,oBAAS,CAACK,MAAM,EAChBL,oBAAS,CAACE,MAAM,CACnB,CAAC;EACFtE,0BAA0B,EAAEoE,oBAAS,CAACM,IAAI;AAC1CnB,EAAAA,OAAO,EAAEa,oBAAS,CAACI,SAAS,CAAC,CACzBJ,oBAAS,CAACC,IAAI,EACdD,oBAAS,CAACK,MAAM,EAChBL,oBAAS,CAACE,MAAM,CACnB,CAAC;EACFjE,OAAO,EAAE+D,oBAAS,CAACC,IAAI;EACvBpE,qBAAqB,EAAEmE,oBAAS,CAACM,IAAI;AACrCxE,EAAAA,GAAG,EAAEkE,oBAAS,CAACE,MAAM,CAACK,UAAU;EAChCxE,KAAK,EAAEiE,oBAAS,CAACE,MAAM;EACvBlE,eAAe,EAAEgE,oBAAS,CAACM,IAAI;EAC/BlE,OAAO,EAAE4D,oBAAS,CAACG,KAAK,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC;AACnD,CAAC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"react-svg.cjs.production.js","sources":["../compiled/owner-window.js","../compiled/shallow-differs.js","../compiled/ReactSVG.js"],"sourcesContent":["// Hat-tip: https://github.com/mui/material-ui/tree/master/packages/mui-utils/src.\nconst ownerWindow = (node) => {\n const doc = node?.ownerDocument || document;\n return doc.defaultView || window;\n};\nexport default ownerWindow;\n","// Hat-tip: https://github.com/developit/preact-compat/blob/master/src/index.js#L402.\nconst shallowDiffers = (a, b) => {\n for (const i in a) {\n if (!(i in b)) {\n return true;\n }\n }\n for (const i in b) {\n if (a[i] !== b[i]) {\n return true;\n }\n }\n return false;\n};\nexport default shallowDiffers;\n","import { SVGInjector } from '@tanem/svg-injector';\nimport * as PropTypes from 'prop-types';\nimport * as React from 'react';\nimport ownerWindow from './owner-window';\nimport shallowDiffers from './shallow-differs';\nconst svgNamespace = 'http://www.w3.org/2000/svg';\nconst xlinkNamespace = 'http://www.w3.org/1999/xlink';\n// Random prefix avoids ID collisions when multiple copies of react-svg are\n// bundled (e.g. microfrontends). The counter ensures each component instance\n// within the same bundle gets a unique ID.\nconst idPrefix = `react-svg-${Math.random().toString(36).slice(2, 6)}`;\nlet idCounter = 0;\nexport class ReactSVG extends React.Component {\n static defaultProps = {\n afterInjection: () => undefined,\n beforeInjection: () => undefined,\n desc: '',\n evalScripts: 'never',\n fallback: null,\n httpRequestWithCredentials: false,\n loading: null,\n onError: () => undefined,\n renumerateIRIElements: true,\n title: '',\n useRequestCache: true,\n wrapper: 'div',\n };\n static propTypes = {\n afterInjection: PropTypes.func,\n beforeInjection: PropTypes.func,\n desc: PropTypes.string,\n evalScripts: PropTypes.oneOf(['always', 'once', 'never']),\n fallback: PropTypes.oneOfType([\n PropTypes.func,\n PropTypes.object,\n PropTypes.string,\n ]),\n httpRequestWithCredentials: PropTypes.bool,\n loading: PropTypes.oneOfType([\n PropTypes.func,\n PropTypes.object,\n PropTypes.string,\n ]),\n onError: PropTypes.func,\n renumerateIRIElements: PropTypes.bool,\n src: PropTypes.string.isRequired,\n title: PropTypes.string,\n useRequestCache: PropTypes.bool,\n wrapper: PropTypes.oneOf(['div', 'span', 'svg']),\n };\n initialState = {\n hasError: false,\n isLoading: true,\n };\n state = this.initialState;\n _isMounted = false;\n reactWrapper;\n nonReactWrapper;\n refCallback = (reactWrapper) => {\n this.reactWrapper = reactWrapper;\n };\n renderSVG() {\n /* istanbul ignore else */\n if (this.reactWrapper instanceof ownerWindow(this.reactWrapper).Node) {\n const { desc, evalScripts, httpRequestWithCredentials, renumerateIRIElements, src, title, useRequestCache, } = this.props;\n const onError = this.props.onError;\n const beforeInjection = this.props.beforeInjection;\n const afterInjection = this.props.afterInjection;\n const wrapper = this.props.wrapper;\n let nonReactWrapper;\n let nonReactTarget;\n if (wrapper === 'svg') {\n nonReactWrapper = document.createElementNS(svgNamespace, wrapper);\n nonReactWrapper.setAttribute('xmlns', svgNamespace);\n nonReactWrapper.setAttribute('xmlns:xlink', xlinkNamespace);\n nonReactTarget = document.createElementNS(svgNamespace, wrapper);\n }\n else {\n nonReactWrapper = document.createElement(wrapper);\n nonReactTarget = document.createElement(wrapper);\n }\n nonReactWrapper.appendChild(nonReactTarget);\n nonReactTarget.dataset.src = src;\n this.nonReactWrapper = this.reactWrapper.appendChild(nonReactWrapper);\n const handleError = (error) => {\n this.removeSVG();\n if (!this._isMounted) {\n onError(error);\n return;\n }\n this.setState(() => ({\n hasError: true,\n isLoading: false,\n }), () => {\n onError(error);\n });\n };\n const afterEach = (error, svg) => {\n if (error) {\n handleError(error);\n return;\n }\n // TODO (Tane): It'd be better to cleanly unsubscribe from SVGInjector\n // callbacks instead of tracking a property like this.\n if (this._isMounted) {\n this.setState(() => ({\n isLoading: false,\n }), () => {\n try {\n afterInjection(svg);\n }\n catch (afterInjectionError) {\n handleError(afterInjectionError);\n }\n });\n }\n };\n // WAI best practice: SVGs need role=\"img\" plus aria-labelledby/\n // aria-describedby pointing to <title>/<desc> element IDs for screen\n // readers to announce them. svg-injector copies the HTML title\n // *attribute* (tooltip) but doesn't create SVG-namespace child\n // elements or ARIA linkage, so we handle that here.\n const beforeEach = (svg) => {\n svg.setAttribute('role', 'img');\n const ariaLabelledBy = [];\n const ariaDescribedBy = [];\n if (title) {\n const originalTitle = svg.querySelector(':scope > title');\n if (originalTitle) {\n svg.removeChild(originalTitle);\n }\n const titleId = `${idPrefix}-title-${++idCounter}`;\n // createElementNS is required: createElement would produce an\n // HTML-namespace node that screen readers ignore inside SVG.\n const newTitle = document.createElementNS(svgNamespace, 'title');\n newTitle.id = titleId;\n newTitle.textContent = title;\n svg.prepend(newTitle);\n ariaLabelledBy.push(titleId);\n }\n if (desc) {\n const originalDesc = svg.querySelector(':scope > desc');\n if (originalDesc) {\n svg.removeChild(originalDesc);\n }\n const descId = `${idPrefix}-desc-${++idCounter}`;\n const newDesc = document.createElementNS(svgNamespace, 'desc');\n newDesc.id = descId;\n newDesc.textContent = desc;\n // Insert after <title> if present, otherwise prepend.\n const existingTitle = svg.querySelector(':scope > title');\n if (existingTitle) {\n existingTitle.after(newDesc);\n }\n else {\n svg.prepend(newDesc);\n }\n ariaDescribedBy.push(descId);\n }\n if (ariaLabelledBy.length > 0) {\n svg.setAttribute('aria-labelledby', ariaLabelledBy.join(' '));\n }\n if (ariaDescribedBy.length > 0) {\n svg.setAttribute('aria-describedby', ariaDescribedBy.join(' '));\n }\n try {\n beforeInjection(svg);\n }\n catch (error) {\n handleError(error);\n }\n };\n SVGInjector(nonReactTarget, {\n afterEach,\n beforeEach,\n cacheRequests: useRequestCache,\n evalScripts,\n httpRequestWithCredentials,\n renumerateIRIElements,\n });\n }\n }\n removeSVG() {\n if (this.nonReactWrapper?.parentNode) {\n this.nonReactWrapper.parentNode.removeChild(this.nonReactWrapper);\n this.nonReactWrapper = null;\n }\n }\n componentDidMount() {\n this._isMounted = true;\n this.renderSVG();\n }\n componentDidUpdate(prevProps) {\n if (shallowDiffers({ ...prevProps }, this.props)) {\n this.setState(() => this.initialState, () => {\n this.removeSVG();\n this.renderSVG();\n });\n }\n }\n componentWillUnmount() {\n this._isMounted = false;\n this.removeSVG();\n }\n render() {\n /* eslint-disable @typescript-eslint/no-unused-vars */\n const { afterInjection, beforeInjection, desc, evalScripts, fallback: Fallback, httpRequestWithCredentials, loading: Loading, renumerateIRIElements, src, title, useRequestCache, wrapper, ...rest } = this.props;\n /* eslint-enable @typescript-eslint/no-unused-vars */\n const Wrapper = wrapper;\n return (React.createElement(Wrapper, { ...rest, ref: this.refCallback, ...(wrapper === 'svg'\n ? {\n xmlns: svgNamespace,\n xmlnsXlink: xlinkNamespace,\n }\n : {}) },\n this.state.isLoading && Loading && React.createElement(Loading, null),\n this.state.hasError && Fallback && React.createElement(Fallback, null)));\n }\n}\n"],"names":["ownerWindow","node","ownerDocument","document","defaultView","window","shallowDiffers","a","b","i","svgNamespace","xlinkNamespace","idPrefix","Math","random","toString","slice","idCounter","ReactSVG","_React$Component","_this","_len","arguments","length","args","Array","_key","call","apply","this","concat","initialState","hasError","isLoading","state","_isMounted","reactWrapper","nonReactWrapper","refCallback","_inheritsLoose","_proto","prototype","renderSVG","_this2","Node","nonReactTarget","_this$props","props","desc","evalScripts","httpRequestWithCredentials","renumerateIRIElements","src","title","useRequestCache","onError","beforeInjection","afterInjection","wrapper","createElementNS","setAttribute","createElement","appendChild","dataset","handleError","error","removeSVG","setState","SVGInjector","afterEach","svg","afterInjectionError","beforeEach","ariaLabelledBy","ariaDescribedBy","originalTitle","querySelector","removeChild","titleId","newTitle","id","textContent","prepend","push","originalDesc","descId","newDesc","existingTitle","after","join","cacheRequests","_this$nonReactWrapper","parentNode","componentDidMount","componentDidUpdate","prevProps","_this3","_extends","componentWillUnmount","render","_this$props2","Fallback","fallback","Loading","loading","rest","_objectWithoutPropertiesLoose","_excluded","React","ref","xmlns","xmlnsXlink","Component","defaultProps"],"mappings":"+mBACMA,YAAc,SAACC,GAEjB,cADYA,SAAAA,EAAMC,gBAAiBC,UACxBC,aAAeC,MAC9B,ECHMC,eAAiB,SAACC,EAAGC,GACvB,IAAK,IAAMC,KAAKF,EACZ,KAAME,KAAKD,GACP,OAAO,EAGf,IAAK,IAAMC,KAAKD,EACZ,GAAID,EAAEE,KAAOD,EAAEC,GACX,OAAO,EAGf,OAAO,CACX,0LCRMC,aAAe,6BACfC,eAAiB,+BAIjBC,SAAQ,aAAgBC,KAAKC,SAASC,SAAS,IAAIC,MAAM,EAAG,GAC9DC,UAAY,EACHC,kBAAQC,GAAA,SAAAD,IAAA,IAAA,IAAAE,EAAAC,EAAAC,UAAAC,OAAAC,EAAA,IAAAC,MAAAJ,GAAAK,EAAA,EAAAA,EAAAL,EAAAK,IAAAF,EAAAE,GAAAJ,UAAAI,GAgDhB,OAhDgBN,EAAAD,EAAAQ,K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D,KAAKQ,kBAALsD,EAAsBC,aACtB/D,KAAKQ,gBAAgBuD,WAAWf,YAAYhD,KAAKQ,iBACjDR,KAAKQ,gBAAkB,KAE/B,EAACG,EACDqD,kBAAA,WACIhE,KAAKM,YAAa,EAClBN,KAAKa,WACT,EAACF,EACDsD,mBAAA,SAAmBC,GAAW,IAAAC,EAAAnE,KACtBvB,eAAc2F,SAAA,CAAA,EAAMF,GAAalE,KAAKkB,QACtClB,KAAKsC,SAAS,WAAA,OAAM6B,EAAKjE,YAAY,EAAE,WACnCiE,EAAK9B,YACL8B,EAAKtD,WACT,EAER,EAACF,EACD0D,qBAAA,WACIrE,KAAKM,YAAa,EAClBN,KAAKqC,WACT,EAAC1B,EACD2D,OAAA,WAEI,IAAAC,EAAuMvE,KAAKkB,MAAtIsD,EAAQD,EAAlBE,SAAyDC,EAAOH,EAAhBI,QAAsE9C,EAAO0C,EAAP1C,QAAY+C,EAAIC,8BAAAN,EAAAO,WAGlM,OAAQC,iBAAM/C,cADEH,EACmBuC,YAAOQ,EAAI,CAAEI,IAAKhF,KAAKS,aAA6B,QAAZoB,EACjE,CACEoD,MAAOpG,aACPqG,WAAYpG,gBAEd,CAAA,GACNkB,KAAKK,MAAMD,WAAasE,GAAWK,iBAAM/C,cAAc0C,EAAS,MAChE1E,KAAKK,MAAMF,UAAYqE,GAAYO,iBAAM/C,cAAcwC,EAAU,MACzE,EAACnF,CAAA,EA7MyB0F,iBAAMI,WAAvB9F,SACF+F,aAAe,CAClBxD,eAAgB,WAAe,EAC/BD,gBAAiB,WAAe,EAChCR,KAAM,GACNC,YAAa,QACbqD,SAAU,KACVpD,4BAA4B,EAC5BsD,QAAS,KACTjD,QAAS,WAAe,EACxBJ,uBAAuB,EACvBE,MAAO,GACPC,iBAAiB,EACjBI,QAAS"}
1
+ {"version":3,"file":"react-svg.cjs.production.js","sources":["../compiled/owner-window.js","../compiled/shallow-differs.js","../compiled/ReactSVG.js"],"sourcesContent":["// Hat-tip: https://github.com/mui/material-ui/tree/master/packages/mui-utils/src.\nconst ownerWindow = (node) => {\n const doc = node?.ownerDocument || document;\n return doc.defaultView || window;\n};\nexport default ownerWindow;\n","// Hat-tip: https://github.com/developit/preact-compat/blob/master/src/index.js#L402.\nconst shallowDiffers = (a, b) => {\n for (const i in a) {\n if (!(i in b)) {\n return true;\n }\n }\n for (const i in b) {\n if (a[i] !== b[i]) {\n return true;\n }\n }\n return false;\n};\nexport default shallowDiffers;\n","import { SVGInjector } from '@tanem/svg-injector';\nimport * as PropTypes from 'prop-types';\nimport * as React from 'react';\nimport ownerWindow from './owner-window';\nimport shallowDiffers from './shallow-differs';\nconst svgNamespace = 'http://www.w3.org/2000/svg';\nconst xlinkNamespace = 'http://www.w3.org/1999/xlink';\n// Random prefix avoids ID collisions when multiple copies of react-svg are\n// bundled (e.g. microfrontends). The counter ensures each component instance\n// within the same bundle gets a unique ID.\nconst idPrefix = `react-svg-${Math.random().toString(36).slice(2, 6)}`;\nlet idCounter = 0;\nexport class ReactSVG extends React.Component {\n static defaultProps = {\n afterInjection: () => undefined,\n beforeInjection: () => undefined,\n desc: '',\n evalScripts: 'never',\n fallback: null,\n httpRequestWithCredentials: false,\n loading: null,\n onError: () => undefined,\n renumerateIRIElements: true,\n title: '',\n useRequestCache: true,\n wrapper: 'div',\n };\n static propTypes = {\n afterInjection: PropTypes.func,\n beforeInjection: PropTypes.func,\n desc: PropTypes.string,\n evalScripts: PropTypes.oneOf(['always', 'once', 'never']),\n fallback: PropTypes.oneOfType([\n PropTypes.func,\n PropTypes.object,\n PropTypes.string,\n ]),\n httpRequestWithCredentials: PropTypes.bool,\n loading: PropTypes.oneOfType([\n PropTypes.func,\n PropTypes.object,\n PropTypes.string,\n ]),\n onError: PropTypes.func,\n renumerateIRIElements: PropTypes.bool,\n src: PropTypes.string.isRequired,\n title: PropTypes.string,\n useRequestCache: PropTypes.bool,\n wrapper: PropTypes.oneOf(['div', 'span', 'svg']),\n };\n initialState = {\n hasError: false,\n isLoading: true,\n };\n state = this.initialState;\n _isMounted = false;\n reactWrapper;\n nonReactWrapper;\n refCallback = (reactWrapper) => {\n this.reactWrapper = reactWrapper;\n };\n renderSVG() {\n /* istanbul ignore else */\n if (this.reactWrapper instanceof ownerWindow(this.reactWrapper).Node) {\n const { desc, evalScripts, httpRequestWithCredentials, renumerateIRIElements, src, title, useRequestCache, } = this.props;\n const onError = this.props.onError;\n const beforeInjection = this.props.beforeInjection;\n const afterInjection = this.props.afterInjection;\n const wrapper = this.props.wrapper;\n let nonReactWrapper;\n let nonReactTarget;\n if (wrapper === 'svg') {\n nonReactWrapper = document.createElementNS(svgNamespace, wrapper);\n nonReactWrapper.setAttribute('xmlns', svgNamespace);\n nonReactWrapper.setAttribute('xmlns:xlink', xlinkNamespace);\n nonReactTarget = document.createElementNS(svgNamespace, wrapper);\n }\n else {\n nonReactWrapper = document.createElement(wrapper);\n nonReactTarget = document.createElement(wrapper);\n }\n nonReactWrapper.appendChild(nonReactTarget);\n nonReactTarget.dataset.src = src;\n this.nonReactWrapper = this.reactWrapper.appendChild(nonReactWrapper);\n const handleError = (error) => {\n this.removeSVG();\n if (!this._isMounted) {\n onError(error);\n return;\n }\n this.setState(() => ({\n hasError: true,\n isLoading: false,\n }), () => {\n onError(error);\n });\n };\n const afterEach = (error, svg) => {\n if (error) {\n handleError(error);\n return;\n }\n // TODO (Tane): It'd be better to cleanly unsubscribe from SVGInjector\n // callbacks instead of tracking a property like this.\n if (this._isMounted) {\n this.setState(() => ({\n isLoading: false,\n }), () => {\n try {\n afterInjection(svg);\n }\n catch (afterInjectionError) {\n handleError(afterInjectionError);\n }\n });\n }\n };\n // WAI best practice: SVGs need role=\"img\" plus aria-labelledby/\n // aria-describedby pointing to <title>/<desc> element IDs for screen\n // readers to announce them. svg-injector copies the HTML title\n // *attribute* (tooltip) but doesn't create SVG-namespace child\n // elements or ARIA linkage, so we handle that here.\n const beforeEach = (svg) => {\n svg.setAttribute('role', 'img');\n const ariaLabelledBy = [];\n const ariaDescribedBy = [];\n if (title) {\n const originalTitle = svg.querySelector(':scope > title');\n if (originalTitle) {\n svg.removeChild(originalTitle);\n }\n const titleId = `${idPrefix}-title-${++idCounter}`;\n // createElementNS is required: createElement would produce an\n // HTML-namespace node that screen readers ignore inside SVG.\n const newTitle = document.createElementNS(svgNamespace, 'title');\n newTitle.id = titleId;\n newTitle.textContent = title;\n svg.prepend(newTitle);\n ariaLabelledBy.push(titleId);\n }\n if (desc) {\n const originalDesc = svg.querySelector(':scope > desc');\n if (originalDesc) {\n svg.removeChild(originalDesc);\n }\n const descId = `${idPrefix}-desc-${++idCounter}`;\n const newDesc = document.createElementNS(svgNamespace, 'desc');\n newDesc.id = descId;\n newDesc.textContent = desc;\n const existingTitle = svg.querySelector(':scope > title');\n if (existingTitle) {\n existingTitle.after(newDesc);\n }\n else {\n svg.prepend(newDesc);\n }\n ariaDescribedBy.push(descId);\n }\n if (ariaLabelledBy.length > 0) {\n svg.setAttribute('aria-labelledby', ariaLabelledBy.join(' '));\n }\n if (ariaDescribedBy.length > 0) {\n svg.setAttribute('aria-describedby', ariaDescribedBy.join(' '));\n }\n try {\n beforeInjection(svg);\n }\n catch (error) {\n handleError(error);\n }\n };\n SVGInjector(nonReactTarget, {\n afterEach,\n beforeEach,\n cacheRequests: useRequestCache,\n evalScripts,\n httpRequestWithCredentials,\n renumerateIRIElements,\n });\n }\n }\n removeSVG() {\n if (this.nonReactWrapper?.parentNode) {\n this.nonReactWrapper.parentNode.removeChild(this.nonReactWrapper);\n this.nonReactWrapper = null;\n }\n }\n componentDidMount() {\n this._isMounted = true;\n this.renderSVG();\n }\n componentDidUpdate(prevProps) {\n if (shallowDiffers({ ...prevProps }, this.props)) {\n this.setState(() => this.initialState, () => {\n this.removeSVG();\n this.renderSVG();\n });\n }\n }\n componentWillUnmount() {\n this._isMounted = false;\n this.removeSVG();\n }\n render() {\n /* eslint-disable @typescript-eslint/no-unused-vars */\n const { afterInjection, beforeInjection, desc, evalScripts, fallback: Fallback, httpRequestWithCredentials, loading: Loading, renumerateIRIElements, src, title, useRequestCache, wrapper, ...rest } = this.props;\n /* eslint-enable @typescript-eslint/no-unused-vars */\n const Wrapper = wrapper;\n return (React.createElement(Wrapper, { ...rest, ref: this.refCallback, ...(wrapper === 'svg'\n ? {\n xmlns: svgNamespace,\n xmlnsXlink: xlinkNamespace,\n }\n : {}) },\n this.state.isLoading && Loading && React.createElement(Loading, null),\n this.state.hasError && Fallback && React.createElement(Fallback, null)));\n }\n}\n"],"names":["ownerWindow","node","ownerDocument","document","defaultView","window","shallowDiffers","a","b","i","svgNamespace","xlinkNamespace","idPrefix","Math","random","toString","slice","idCounter","ReactSVG","_React$Component","_this","_len","arguments","length","args","Array","_key","call","apply","this","concat","initialState","hasError","isLoading","state","_isMounted","reactWrapper","nonReactWrapper","refCallback","_inheritsLoose","_proto","prototype","renderSVG","_this2","Node","nonReactTarget","_this$props","props","desc","evalScripts","httpRequestWithCredentials","renumerateIRIElements","src","title","useRequestCache","onError","beforeInjection","afterInjection","wrapper","createElementNS","setAttribute","createElement","appendChild","dataset","handleError","error","removeSVG","setState","SVGInjector","afterEach","svg","afterInjectionError","beforeEach","ariaLabelledBy","ariaDescribedBy","originalTitle","querySelector","removeChild","titleId","newTitle","id","textContent","prepend","push","originalDesc","descId","newDesc","existingTitle","after","join","cacheRequests","_this$nonReactWrapper","parentNode","componentDidMount","componentDidUpdate","prevProps","_this3","_extends","componentWillUnmount","render","_this$props2","Fallback","fallback","Loading","loading","rest","_objectWithoutPropertiesLoose","_excluded","React","ref","xmlns","xmlnsXlink","Component","defaultProps"],"mappings":"+mBACMA,YAAc,SAACC,GAEjB,cADYA,SAAAA,EAAMC,gBAAiBC,UACxBC,aAAeC,MAC9B,ECHMC,eAAiB,SAACC,EAAGC,GACvB,IAAK,IAAMC,KAAKF,EACZ,KAAME,KAAKD,GACP,OAAO,EAGf,IAAK,IAAMC,KAAKD,EACZ,GAAID,EAAEE,KAAOD,EAAEC,GACX,OAAO,EAGf,OA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,CAClBxD,eAAgB,WAAe,EAC/BD,gBAAiB,WAAe,EAChCR,KAAM,GACNC,YAAa,QACbqD,SAAU,KACVpD,4BAA4B,EAC5BsD,QAAS,KACTjD,QAAS,WAAe,EACxBJ,uBAAuB,EACvBE,MAAO,GACPC,iBAAiB,EACjBI,QAAS"}
@@ -154,7 +154,6 @@ var ReactSVG = /*#__PURE__*/function (_React$Component) {
154
154
  var newDesc = document.createElementNS(svgNamespace, 'desc');
155
155
  newDesc.id = descId;
156
156
  newDesc.textContent = desc;
157
- // Insert after <title> if present, otherwise prepend.
158
157
  var existingTitle = svg.querySelector(':scope > title');
159
158
  if (existingTitle) {
160
159
  existingTitle.after(newDesc);
@@ -1 +1 @@
1
- {"version":3,"file":"react-svg.esm.js","sources":["../compiled/owner-window.js","../compiled/shallow-differs.js","../compiled/ReactSVG.js"],"sourcesContent":["// Hat-tip: https://github.com/mui/material-ui/tree/master/packages/mui-utils/src.\nconst ownerWindow = (node) => {\n const doc = node?.ownerDocument || document;\n return doc.defaultView || window;\n};\nexport default ownerWindow;\n","// Hat-tip: https://github.com/developit/preact-compat/blob/master/src/index.js#L402.\nconst shallowDiffers = (a, b) => {\n for (const i in a) {\n if (!(i in b)) {\n return true;\n }\n }\n for (const i in b) {\n if (a[i] !== b[i]) {\n return true;\n }\n }\n return false;\n};\nexport default shallowDiffers;\n","import { SVGInjector } from '@tanem/svg-injector';\nimport * as PropTypes from 'prop-types';\nimport * as React from 'react';\nimport ownerWindow from './owner-window';\nimport shallowDiffers from './shallow-differs';\nconst svgNamespace = 'http://www.w3.org/2000/svg';\nconst xlinkNamespace = 'http://www.w3.org/1999/xlink';\n// Random prefix avoids ID collisions when multiple copies of react-svg are\n// bundled (e.g. microfrontends). The counter ensures each component instance\n// within the same bundle gets a unique ID.\nconst idPrefix = `react-svg-${Math.random().toString(36).slice(2, 6)}`;\nlet idCounter = 0;\nexport class ReactSVG extends React.Component {\n static defaultProps = {\n afterInjection: () => undefined,\n beforeInjection: () => undefined,\n desc: '',\n evalScripts: 'never',\n fallback: null,\n httpRequestWithCredentials: false,\n loading: null,\n onError: () => undefined,\n renumerateIRIElements: true,\n title: '',\n useRequestCache: true,\n wrapper: 'div',\n };\n static propTypes = {\n afterInjection: PropTypes.func,\n beforeInjection: PropTypes.func,\n desc: PropTypes.string,\n evalScripts: PropTypes.oneOf(['always', 'once', 'never']),\n fallback: PropTypes.oneOfType([\n PropTypes.func,\n PropTypes.object,\n PropTypes.string,\n ]),\n httpRequestWithCredentials: PropTypes.bool,\n loading: PropTypes.oneOfType([\n PropTypes.func,\n PropTypes.object,\n PropTypes.string,\n ]),\n onError: PropTypes.func,\n renumerateIRIElements: PropTypes.bool,\n src: PropTypes.string.isRequired,\n title: PropTypes.string,\n useRequestCache: PropTypes.bool,\n wrapper: PropTypes.oneOf(['div', 'span', 'svg']),\n };\n initialState = {\n hasError: false,\n isLoading: true,\n };\n state = this.initialState;\n _isMounted = false;\n reactWrapper;\n nonReactWrapper;\n refCallback = (reactWrapper) => {\n this.reactWrapper = reactWrapper;\n };\n renderSVG() {\n /* istanbul ignore else */\n if (this.reactWrapper instanceof ownerWindow(this.reactWrapper).Node) {\n const { desc, evalScripts, httpRequestWithCredentials, renumerateIRIElements, src, title, useRequestCache, } = this.props;\n const onError = this.props.onError;\n const beforeInjection = this.props.beforeInjection;\n const afterInjection = this.props.afterInjection;\n const wrapper = this.props.wrapper;\n let nonReactWrapper;\n let nonReactTarget;\n if (wrapper === 'svg') {\n nonReactWrapper = document.createElementNS(svgNamespace, wrapper);\n nonReactWrapper.setAttribute('xmlns', svgNamespace);\n nonReactWrapper.setAttribute('xmlns:xlink', xlinkNamespace);\n nonReactTarget = document.createElementNS(svgNamespace, wrapper);\n }\n else {\n nonReactWrapper = document.createElement(wrapper);\n nonReactTarget = document.createElement(wrapper);\n }\n nonReactWrapper.appendChild(nonReactTarget);\n nonReactTarget.dataset.src = src;\n this.nonReactWrapper = this.reactWrapper.appendChild(nonReactWrapper);\n const handleError = (error) => {\n this.removeSVG();\n if (!this._isMounted) {\n onError(error);\n return;\n }\n this.setState(() => ({\n hasError: true,\n isLoading: false,\n }), () => {\n onError(error);\n });\n };\n const afterEach = (error, svg) => {\n if (error) {\n handleError(error);\n return;\n }\n // TODO (Tane): It'd be better to cleanly unsubscribe from SVGInjector\n // callbacks instead of tracking a property like this.\n if (this._isMounted) {\n this.setState(() => ({\n isLoading: false,\n }), () => {\n try {\n afterInjection(svg);\n }\n catch (afterInjectionError) {\n handleError(afterInjectionError);\n }\n });\n }\n };\n // WAI best practice: SVGs need role=\"img\" plus aria-labelledby/\n // aria-describedby pointing to <title>/<desc> element IDs for screen\n // readers to announce them. svg-injector copies the HTML title\n // *attribute* (tooltip) but doesn't create SVG-namespace child\n // elements or ARIA linkage, so we handle that here.\n const beforeEach = (svg) => {\n svg.setAttribute('role', 'img');\n const ariaLabelledBy = [];\n const ariaDescribedBy = [];\n if (title) {\n const originalTitle = svg.querySelector(':scope > title');\n if (originalTitle) {\n svg.removeChild(originalTitle);\n }\n const titleId = `${idPrefix}-title-${++idCounter}`;\n // createElementNS is required: createElement would produce an\n // HTML-namespace node that screen readers ignore inside SVG.\n const newTitle = document.createElementNS(svgNamespace, 'title');\n newTitle.id = titleId;\n newTitle.textContent = title;\n svg.prepend(newTitle);\n ariaLabelledBy.push(titleId);\n }\n if (desc) {\n const originalDesc = svg.querySelector(':scope > desc');\n if (originalDesc) {\n svg.removeChild(originalDesc);\n }\n const descId = `${idPrefix}-desc-${++idCounter}`;\n const newDesc = document.createElementNS(svgNamespace, 'desc');\n newDesc.id = descId;\n newDesc.textContent = desc;\n // Insert after <title> if present, otherwise prepend.\n const existingTitle = svg.querySelector(':scope > title');\n if (existingTitle) {\n existingTitle.after(newDesc);\n }\n else {\n svg.prepend(newDesc);\n }\n ariaDescribedBy.push(descId);\n }\n if (ariaLabelledBy.length > 0) {\n svg.setAttribute('aria-labelledby', ariaLabelledBy.join(' '));\n }\n if (ariaDescribedBy.length > 0) {\n svg.setAttribute('aria-describedby', ariaDescribedBy.join(' '));\n }\n try {\n beforeInjection(svg);\n }\n catch (error) {\n handleError(error);\n }\n };\n SVGInjector(nonReactTarget, {\n afterEach,\n beforeEach,\n cacheRequests: useRequestCache,\n evalScripts,\n httpRequestWithCredentials,\n renumerateIRIElements,\n });\n }\n }\n removeSVG() {\n if (this.nonReactWrapper?.parentNode) {\n this.nonReactWrapper.parentNode.removeChild(this.nonReactWrapper);\n this.nonReactWrapper = null;\n }\n }\n componentDidMount() {\n this._isMounted = true;\n this.renderSVG();\n }\n componentDidUpdate(prevProps) {\n if (shallowDiffers({ ...prevProps }, this.props)) {\n this.setState(() => this.initialState, () => {\n this.removeSVG();\n this.renderSVG();\n });\n }\n }\n componentWillUnmount() {\n this._isMounted = false;\n this.removeSVG();\n }\n render() {\n /* eslint-disable @typescript-eslint/no-unused-vars */\n const { afterInjection, beforeInjection, desc, evalScripts, fallback: Fallback, httpRequestWithCredentials, loading: Loading, renumerateIRIElements, src, title, useRequestCache, wrapper, ...rest } = this.props;\n /* eslint-enable @typescript-eslint/no-unused-vars */\n const Wrapper = wrapper;\n return (React.createElement(Wrapper, { ...rest, ref: this.refCallback, ...(wrapper === 'svg'\n ? {\n xmlns: svgNamespace,\n xmlnsXlink: xlinkNamespace,\n }\n : {}) },\n this.state.isLoading && Loading && React.createElement(Loading, null),\n this.state.hasError && Fallback && React.createElement(Fallback, null)));\n }\n}\n"],"names":["ownerWindow","node","doc","ownerDocument","document","defaultView","window","shallowDiffers","a","b","i","svgNamespace","xlinkNamespace","idPrefix","Math","random","toString","slice","idCounter","ReactSVG","_React$Component","_this","_len","arguments","length","args","Array","_key","call","apply","concat","initialState","hasError","isLoading","state","_isMounted","reactWrapper","nonReactWrapper","refCallback","_inheritsLoose","_proto","prototype","renderSVG","_this2","Node","_this$props","props","desc","evalScripts","httpRequestWithCredentials","renumerateIRIElements","src","title","useRequestCache","onError","beforeInjection","afterInjection","wrapper","nonReactTarget","createElementNS","setAttribute","createElement","appendChild","dataset","handleError","error","removeSVG","setState","afterEach","svg","afterInjectionError","beforeEach","ariaLabelledBy","ariaDescribedBy","originalTitle","querySelector","removeChild","titleId","newTitle","id","textContent","prepend","push","originalDesc","descId","newDesc","existingTitle","after","join","SVGInjector","cacheRequests","_this$nonReactWrapper","parentNode","componentDidMount","componentDidUpdate","prevProps","_this3","_extends","componentWillUnmount","render","_this$props2","Fallback","fallback","Loading","loading","rest","_objectWithoutPropertiesLoose","_excluded","Wrapper","React","ref","xmlns","xmlnsXlink","Component","defaultProps","undefined","propTypes","PropTypes","func","string","oneOf","oneOfType","object","bool","isRequired"],"mappings":";;;;;;;AAAA;AACA,IAAMA,WAAW,GAAG,SAAdA,WAAWA,CAAIC,IAAI,EAAK;EAC1B,IAAMC,GAAG,GAAG,CAAAD,IAAI,oBAAJA,IAAI,CAAEE,aAAa,KAAIC,QAAQ;AAC3C,EAAA,OAAOF,GAAG,CAACG,WAAW,IAAIC,MAAM;AACpC,CAAC;;ACJD;AACA,IAAMC,cAAc,GAAG,SAAjBA,cAAcA,CAAIC,CAAC,EAAEC,CAAC,EAAK;AAC7B,EAAA,KAAK,IAAMC,CAAC,IAAIF,CAAC,EAAE;AACf,IAAA,IAAI,EAAEE,CAAC,IAAID,CAAC,CAAC,EAAE;AACX,MAAA,OAAO,IAAI;AACf,IAAA;AACJ,EAAA;AACA,EAAA,KAAK,IAAMC,EAAC,IAAID,CAAC,EAAE;IACf,IAAID,CAAC,CAACE,EAAC,CAAC,KAAKD,CAAC,CAACC,EAAC,CAAC,EAAE;AACf,MAAA,OAAO,IAAI;AACf,IAAA;AACJ,EAAA;AACA,EAAA,OAAO,KAAK;AAChB,CAAC;;;ACRD,IAAMC,YAAY,GAAG,4BAA4B;AACjD,IAAMC,cAAc,GAAG,8BAA8B;AACrD;AACA;AACA;AACA,IAAMC,QAAQ,GAAA,YAAA,GAAgBC,IAAI,CAACC,MAAM,EAAE,CAACC,QAAQ,CAAC,EAAE,CAAC,CAACC,KA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AACb,CAAC;AAdQtC,QAAQ,CAeViG,SAAS,GAAG;EACf5D,cAAc,EAAE6D,SAAS,CAACC,IAAI;EAC9B/D,eAAe,EAAE8D,SAAS,CAACC,IAAI;EAC/BvE,IAAI,EAAEsE,SAAS,CAACE,MAAM;AACtBvE,EAAAA,WAAW,EAAEqE,SAAS,CAACG,KAAK,CAAC,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;AACzDlB,EAAAA,QAAQ,EAAEe,SAAS,CAACI,SAAS,CAAC,CAC1BJ,SAAS,CAACC,IAAI,EACdD,SAAS,CAACK,MAAM,EAChBL,SAAS,CAACE,MAAM,CACnB,CAAC;EACFtE,0BAA0B,EAAEoE,SAAS,CAACM,IAAI;AAC1CnB,EAAAA,OAAO,EAAEa,SAAS,CAACI,SAAS,CAAC,CACzBJ,SAAS,CAACC,IAAI,EACdD,SAAS,CAACK,MAAM,EAChBL,SAAS,CAACE,MAAM,CACnB,CAAC;EACFjE,OAAO,EAAE+D,SAAS,CAACC,IAAI;EACvBpE,qBAAqB,EAAEmE,SAAS,CAACM,IAAI;AACrCxE,EAAAA,GAAG,EAAEkE,SAAS,CAACE,MAAM,CAACK,UAAU;EAChCxE,KAAK,EAAEiE,SAAS,CAACE,MAAM;EACvBlE,eAAe,EAAEgE,SAAS,CAACM,IAAI;EAC/BlE,OAAO,EAAE4D,SAAS,CAACG,KAAK,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC;AACnD,CAAC,CAAA;;;;"}
1
+ {"version":3,"file":"react-svg.esm.js","sources":["../compiled/owner-window.js","../compiled/shallow-differs.js","../compiled/ReactSVG.js"],"sourcesContent":["// Hat-tip: https://github.com/mui/material-ui/tree/master/packages/mui-utils/src.\nconst ownerWindow = (node) => {\n const doc = node?.ownerDocument || document;\n return doc.defaultView || window;\n};\nexport default ownerWindow;\n","// Hat-tip: https://github.com/developit/preact-compat/blob/master/src/index.js#L402.\nconst shallowDiffers = (a, b) => {\n for (const i in a) {\n if (!(i in b)) {\n return true;\n }\n }\n for (const i in b) {\n if (a[i] !== b[i]) {\n return true;\n }\n }\n return false;\n};\nexport default shallowDiffers;\n","import { SVGInjector } from '@tanem/svg-injector';\nimport * as PropTypes from 'prop-types';\nimport * as React from 'react';\nimport ownerWindow from './owner-window';\nimport shallowDiffers from './shallow-differs';\nconst svgNamespace = 'http://www.w3.org/2000/svg';\nconst xlinkNamespace = 'http://www.w3.org/1999/xlink';\n// Random prefix avoids ID collisions when multiple copies of react-svg are\n// bundled (e.g. microfrontends). The counter ensures each component instance\n// within the same bundle gets a unique ID.\nconst idPrefix = `react-svg-${Math.random().toString(36).slice(2, 6)}`;\nlet idCounter = 0;\nexport class ReactSVG extends React.Component {\n static defaultProps = {\n afterInjection: () => undefined,\n beforeInjection: () => undefined,\n desc: '',\n evalScripts: 'never',\n fallback: null,\n httpRequestWithCredentials: false,\n loading: null,\n onError: () => undefined,\n renumerateIRIElements: true,\n title: '',\n useRequestCache: true,\n wrapper: 'div',\n };\n static propTypes = {\n afterInjection: PropTypes.func,\n beforeInjection: PropTypes.func,\n desc: PropTypes.string,\n evalScripts: PropTypes.oneOf(['always', 'once', 'never']),\n fallback: PropTypes.oneOfType([\n PropTypes.func,\n PropTypes.object,\n PropTypes.string,\n ]),\n httpRequestWithCredentials: PropTypes.bool,\n loading: PropTypes.oneOfType([\n PropTypes.func,\n PropTypes.object,\n PropTypes.string,\n ]),\n onError: PropTypes.func,\n renumerateIRIElements: PropTypes.bool,\n src: PropTypes.string.isRequired,\n title: PropTypes.string,\n useRequestCache: PropTypes.bool,\n wrapper: PropTypes.oneOf(['div', 'span', 'svg']),\n };\n initialState = {\n hasError: false,\n isLoading: true,\n };\n state = this.initialState;\n _isMounted = false;\n reactWrapper;\n nonReactWrapper;\n refCallback = (reactWrapper) => {\n this.reactWrapper = reactWrapper;\n };\n renderSVG() {\n /* istanbul ignore else */\n if (this.reactWrapper instanceof ownerWindow(this.reactWrapper).Node) {\n const { desc, evalScripts, httpRequestWithCredentials, renumerateIRIElements, src, title, useRequestCache, } = this.props;\n const onError = this.props.onError;\n const beforeInjection = this.props.beforeInjection;\n const afterInjection = this.props.afterInjection;\n const wrapper = this.props.wrapper;\n let nonReactWrapper;\n let nonReactTarget;\n if (wrapper === 'svg') {\n nonReactWrapper = document.createElementNS(svgNamespace, wrapper);\n nonReactWrapper.setAttribute('xmlns', svgNamespace);\n nonReactWrapper.setAttribute('xmlns:xlink', xlinkNamespace);\n nonReactTarget = document.createElementNS(svgNamespace, wrapper);\n }\n else {\n nonReactWrapper = document.createElement(wrapper);\n nonReactTarget = document.createElement(wrapper);\n }\n nonReactWrapper.appendChild(nonReactTarget);\n nonReactTarget.dataset.src = src;\n this.nonReactWrapper = this.reactWrapper.appendChild(nonReactWrapper);\n const handleError = (error) => {\n this.removeSVG();\n if (!this._isMounted) {\n onError(error);\n return;\n }\n this.setState(() => ({\n hasError: true,\n isLoading: false,\n }), () => {\n onError(error);\n });\n };\n const afterEach = (error, svg) => {\n if (error) {\n handleError(error);\n return;\n }\n // TODO (Tane): It'd be better to cleanly unsubscribe from SVGInjector\n // callbacks instead of tracking a property like this.\n if (this._isMounted) {\n this.setState(() => ({\n isLoading: false,\n }), () => {\n try {\n afterInjection(svg);\n }\n catch (afterInjectionError) {\n handleError(afterInjectionError);\n }\n });\n }\n };\n // WAI best practice: SVGs need role=\"img\" plus aria-labelledby/\n // aria-describedby pointing to <title>/<desc> element IDs for screen\n // readers to announce them. svg-injector copies the HTML title\n // *attribute* (tooltip) but doesn't create SVG-namespace child\n // elements or ARIA linkage, so we handle that here.\n const beforeEach = (svg) => {\n svg.setAttribute('role', 'img');\n const ariaLabelledBy = [];\n const ariaDescribedBy = [];\n if (title) {\n const originalTitle = svg.querySelector(':scope > title');\n if (originalTitle) {\n svg.removeChild(originalTitle);\n }\n const titleId = `${idPrefix}-title-${++idCounter}`;\n // createElementNS is required: createElement would produce an\n // HTML-namespace node that screen readers ignore inside SVG.\n const newTitle = document.createElementNS(svgNamespace, 'title');\n newTitle.id = titleId;\n newTitle.textContent = title;\n svg.prepend(newTitle);\n ariaLabelledBy.push(titleId);\n }\n if (desc) {\n const originalDesc = svg.querySelector(':scope > desc');\n if (originalDesc) {\n svg.removeChild(originalDesc);\n }\n const descId = `${idPrefix}-desc-${++idCounter}`;\n const newDesc = document.createElementNS(svgNamespace, 'desc');\n newDesc.id = descId;\n newDesc.textContent = desc;\n const existingTitle = svg.querySelector(':scope > title');\n if (existingTitle) {\n existingTitle.after(newDesc);\n }\n else {\n svg.prepend(newDesc);\n }\n ariaDescribedBy.push(descId);\n }\n if (ariaLabelledBy.length > 0) {\n svg.setAttribute('aria-labelledby', ariaLabelledBy.join(' '));\n }\n if (ariaDescribedBy.length > 0) {\n svg.setAttribute('aria-describedby', ariaDescribedBy.join(' '));\n }\n try {\n beforeInjection(svg);\n }\n catch (error) {\n handleError(error);\n }\n };\n SVGInjector(nonReactTarget, {\n afterEach,\n beforeEach,\n cacheRequests: useRequestCache,\n evalScripts,\n httpRequestWithCredentials,\n renumerateIRIElements,\n });\n }\n }\n removeSVG() {\n if (this.nonReactWrapper?.parentNode) {\n this.nonReactWrapper.parentNode.removeChild(this.nonReactWrapper);\n this.nonReactWrapper = null;\n }\n }\n componentDidMount() {\n this._isMounted = true;\n this.renderSVG();\n }\n componentDidUpdate(prevProps) {\n if (shallowDiffers({ ...prevProps }, this.props)) {\n this.setState(() => this.initialState, () => {\n this.removeSVG();\n this.renderSVG();\n });\n }\n }\n componentWillUnmount() {\n this._isMounted = false;\n this.removeSVG();\n }\n render() {\n /* eslint-disable @typescript-eslint/no-unused-vars */\n const { afterInjection, beforeInjection, desc, evalScripts, fallback: Fallback, httpRequestWithCredentials, loading: Loading, renumerateIRIElements, src, title, useRequestCache, wrapper, ...rest } = this.props;\n /* eslint-enable @typescript-eslint/no-unused-vars */\n const Wrapper = wrapper;\n return (React.createElement(Wrapper, { ...rest, ref: this.refCallback, ...(wrapper === 'svg'\n ? {\n xmlns: svgNamespace,\n xmlnsXlink: xlinkNamespace,\n }\n : {}) },\n this.state.isLoading && Loading && React.createElement(Loading, null),\n this.state.hasError && Fallback && React.createElement(Fallback, null)));\n }\n}\n"],"names":["ownerWindow","node","doc","ownerDocument","document","defaultView","window","shallowDiffers","a","b","i","svgNamespace","xlinkNamespace","idPrefix","Math","random","toString","slice","idCounter","ReactSVG","_React$Component","_this","_len","arguments","length","args","Array","_key","call","apply","concat","initialState","hasError","isLoading","state","_isMounted","reactWrapper","nonReactWrapper","refCallback","_inheritsLoose","_proto","prototype","renderSVG","_this2","Node","_this$props","props","desc","evalScripts","httpRequestWithCredentials","renumerateIRIElements","src","title","useRequestCache","onError","beforeInjection","afterInjection","wrapper","nonReactTarget","createElementNS","setAttribute","createElement","appendChild","dataset","handleError","error","removeSVG","setState","afterEach","svg","afterInjectionError","beforeEach","ariaLabelledBy","ariaDescribedBy","originalTitle","querySelector","removeChild","titleId","newTitle","id","textContent","prepend","push","originalDesc","descId","newDesc","existingTitle","after","join","SVGInjector","cacheRequests","_this$nonReactWrapper","parentNode","componentDidMount","componentDidUpdate","prevProps","_this3","_extends","componentWillUnmount","render","_this$props2","Fallback","fallback","Loading","loading","rest","_objectWithoutPropertiesLoose","_excluded","Wrapper","React","ref","xmlns","xmlnsXlink","Component","defaultProps","undefined","propTypes","PropTypes","func","string","oneOf","oneOfType","object","bool","isRequired"],"mappings":";;;;;;;AAAA;AACA,IAAMA,WAAW,GAAG,SAAdA,WAAWA,CAAIC,IAAI,EAAK;EAC1B,IAAMC,GAAG,GAAG,CAAAD,IAAI,oBAAJA,IAAI,CAAEE,aAAa,KAAIC,QAAQ;AAC3C,EAAA,OAAOF,GAAG,CAACG,WAAW,IAAIC,MAAM;AACpC,CAAC;;ACJD;AACA,IAAMC,cAAc,GAAG,SAAjBA,cAAcA,CAAIC,CAAC,EAAEC,CAAC,EAAK;AAC7B,EAAA,KAAK,IAAMC,CAAC,IAAIF,CAAC,EAAE;AACf,IAAA,IAAI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iE,SAAS,CAACE,MAAM;EACvBlE,eAAe,EAAEgE,SAAS,CAACM,IAAI;EAC/BlE,OAAO,EAAE4D,SAAS,CAACG,KAAK,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC;AACnD,CAAC,CAAA;;;;"}
@@ -944,7 +944,6 @@
944
944
  var newDesc = document.createElementNS(svgNamespace, 'desc');
945
945
  newDesc.id = descId;
946
946
  newDesc.textContent = desc;
947
- // Insert after <title> if present, otherwise prepend.
948
947
  var existingTitle = svg.querySelector(':scope > title');
949
948
  if (existingTitle) {
950
949
  existingTitle.after(newDesc);