react-svg 17.1.1 → 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,30 +27,31 @@ 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
- - 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)
37
- - 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)
38
- - 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)
39
- - 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)
40
- - 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)
41
- - 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)
42
- - 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)
43
- - 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)
44
- - 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)
45
- - 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)
46
- - 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)
47
- - 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)
48
49
 
49
50
  ## API
50
51
 
51
52
  **Props**
52
53
 
53
- - `src` - The SVG URL. Must be a fetchable URL (relative or absolute): `data:` URIs and inline SVG strings are not supported. Supports SVG sprite sheets via fragment identifiers (e.g. `sprite.svg#icon-star`): see the [sprite usage example](https://github.com/tanem/react-svg/tree/master/examples/sprite-usage).
54
+ - `src` - The SVG URL. Supports fetchable URLs (relative or absolute), `data:image/svg+xml` URLs (URL-encoded or base64), and SVG sprite sheets via fragment identifiers (e.g. `sprite.svg#icon-star`). See the [data URL example](https://github.com/tanem/react-svg/tree/master/examples/data-url) and [sprite usage example](https://github.com/tanem/react-svg/tree/master/examples/sprite-usage).
54
55
  - `afterInjection(svg)` - _Optional_ Function to call after the SVG is injected. `svg` is the injected SVG DOM element. If an error occurs during execution it will be routed to the `onError` callback, and if a `fallback` is specified it will be rendered. Defaults to `() => {}`.
55
56
  - `beforeInjection(svg)` - _Optional_ Function to call just before the SVG is injected. `svg` is the SVG DOM element which is about to be injected. If an error occurs during execution it will be routed to the `onError` callback, and if a `fallback` is specified it will be rendered. Defaults to `() => {}`.
56
57
  - `desc` - _Optional_ String used for SVG `<desc>` element content. If a `<desc>` exists it will be replaced, otherwise a new `<desc>` is created. When set, a unique `id` is added to the `<desc>` element and `aria-describedby` is set on the SVG for assistive technology. Defaults to `''`, which is a noop.
@@ -158,9 +159,9 @@ Related issues and PRs:
158
159
  Can I use data URIs or inline SVG strings?
159
160
  </summary>
160
161
 
161
- No. The `src` prop must be a fetchable URL. Under the hood, [@tanem/svg-injector](https://github.com/tanem/svg-injector) uses `XMLHttpRequest` to fetch the SVG, so `data:image/svg+xml;base64,...` and `data:image/svg+xml,...` sources are not supported.
162
+ `data:image/svg+xml` URLs are supported (both URL-encoded and base64-encoded). The underlying library parses the SVG content directly from the data URL using `DOMParser`, without making a network request. This is useful when bundlers like Vite inline small SVGs as data URIs. See the [data URL example](https://github.com/tanem/react-svg/tree/master/examples/data-url) for details.
162
163
 
163
- If you already have the SVG markup as a string (for example, a dynamically generated chart), consider parsing it with `DOMParser` and appending the result yourself, or rendering it with `dangerouslySetInnerHTML`. These approaches avoid the fetch step entirely and will also avoid the brief flash that occurs when `react-svg` re-injects on `src` change.
164
+ Inline SVG strings (raw markup passed directly as the `src` prop) are **not** supported. If you already have the SVG markup as a string (for example, a dynamically generated chart), consider parsing it with `DOMParser` and appending the result yourself, or rendering it with `dangerouslySetInnerHTML`. These approaches avoid the fetch step entirely and will also avoid the brief flash that occurs when `react-svg` re-injects on `src` change.
164
165
 
165
166
  **Security note:** inserting SVG strings into the DOM bypasses React's built-in sanitisation and can expose your application to XSS if the content is not trusted. If the SVG originates from user input or a third party, sanitise it first with a library like [DOMPurify](https://github.com/cure53/DOMPurify) before inserting it into the page.
166
167
 
@@ -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":";;;;;;;;;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AS,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
+ {"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;AACj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AAS;AAAA,EAAA,CAAA;AACxBjE,EAAAA,qBAAqB,EAAE,IAAI;AAC3BE,EAAAA,KAAK,EAAE,EAAE;AACTC,EAAAA,eAAe,EAAE,IAAI;AACrBI,EAAAA,OAAO,EAAE;AACb,CAAC;AAdQtC,QAAQ,CAeViG,SAAS,GAAG;EACf5D,cAAc,EAAE6D,oBAAS,CAACC,IAAI;EAC9B/D,eAAe,EAAE8D,oBAAS,CAACC,IAAI;EAC/BvE,IAAI,EAAEsE,oBAAS,CAACE,MAAM;AACtBvE,EAAAA,WAAW,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,K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F,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,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,KAAAC,MAAAT,EAAA,CAAAU,MAAAC,OAAAN,KAAAK,MAsCjBE,aAAe,CACXC,UAAU,EACVC,WAAW,GACdb,EACDc,MAAQd,EAAKW,aAAYX,EACzBe,YAAa,EAAKf,EAClBgB,kBAAY,EAAAhB,EACZiB,qBAAe,EAAAjB,EACfkB,YAAc,SAACF,GACXhB,EAAKgB,aAAeA,CACxB,EAAChB,CAAA,CAAAmB,eAAArB,EAAAC,GAAA,IAAAqB,EAAAtB,EAAAuB,UA4JA,OA5JAD,EACDE,UAAA,WAAY,IAAAC,EAAAd,KAER,GAAIA,KAAKO,wBAAwBpC,YAAY6B,KAAKO,cAAcQ,KAAM,CAClE,IAKIP,EACAQ,EANJC,EAA+GjB,KAAKkB,MAA5GC,EAAIF,EAAJE,KAAMC,EAAWH,EAAXG,YAAaC,EAA0BJ,EAA1BI,2BAA4BC,EAAqBL,EAArBK,sBAAuBC,EAAGN,EAAH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AIC,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,EA5MyB0F,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"}
@@ -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,EA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AAE,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,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ACFtE,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;;;;"}
@@ -466,6 +466,45 @@
466
466
  });
467
467
  };
468
468
 
469
+ var dataUrlPrefix = 'data:image/svg+xml';
470
+ var parseDataUrl = function (url) {
471
+ if (!url.startsWith(dataUrlPrefix)) {
472
+ return null;
473
+ }
474
+ var rest = url.slice(dataUrlPrefix.length);
475
+ var svgString;
476
+ if (rest.startsWith(';base64,')) {
477
+ try {
478
+ svgString = atob(rest.slice(';base64,'.length));
479
+ } catch (_a) {
480
+ return new Error('Invalid base64 in data URL');
481
+ }
482
+ } else if (rest.startsWith(',')) {
483
+ try {
484
+ svgString = decodeURIComponent(rest.slice(','.length));
485
+ } catch (_b) {
486
+ return new Error('Invalid encoding in data URL');
487
+ }
488
+ } else if (rest.startsWith(';charset=utf-8,')) {
489
+ try {
490
+ svgString = decodeURIComponent(rest.slice(';charset=utf-8,'.length));
491
+ } catch (_c) {
492
+ return new Error('Invalid encoding in data URL');
493
+ }
494
+ } else {
495
+ return new Error('Unsupported data URL format');
496
+ }
497
+ var doc = new DOMParser().parseFromString(svgString, 'image/svg+xml');
498
+ var parserError = doc.querySelector('parsererror');
499
+ if (parserError) {
500
+ return new Error('Data URL SVG parse error: ' + parserError.textContent.trim());
501
+ }
502
+ if (!(doc.documentElement instanceof SVGSVGElement)) {
503
+ return new Error('Data URL did not contain a valid SVG element');
504
+ }
505
+ return doc.documentElement;
506
+ };
507
+
469
508
  var idCounter$1 = 0;
470
509
  var uniqueId = function () {
471
510
  return ++idCounter$1;
@@ -492,8 +531,14 @@
492
531
  var hashIndex = elUrl.indexOf('#');
493
532
  var baseUrl = hashIndex !== -1 ? elUrl.slice(0, hashIndex) : elUrl;
494
533
  var symbolId = hashIndex !== -1 ? elUrl.slice(hashIndex + 1) : null;
495
- var loadSvg = cacheRequests ? loadSvgCached : loadSvgUncached;
496
- loadSvg(baseUrl, httpRequestWithCredentials, function (error, loadedSvg) {
534
+ var dataUrlResult = parseDataUrl(baseUrl);
535
+ if (dataUrlResult instanceof Error) {
536
+ injectedElements.splice(injectedElements.indexOf(el), 1);
537
+ el = null;
538
+ callback(dataUrlResult);
539
+ return;
540
+ }
541
+ var handleLoadedSvg = function (error, loadedSvg) {
497
542
  var _a, _b;
498
543
  if (!loadedSvg) {
499
544
  injectedElements.splice(injectedElements.indexOf(el), 1);
@@ -692,7 +737,15 @@
692
737
  injectedElements.splice(injectedElements.indexOf(el), 1);
693
738
  el = null;
694
739
  callback(null, svg);
695
- });
740
+ };
741
+ if (dataUrlResult) {
742
+ setTimeout(function () {
743
+ handleLoadedSvg(null, dataUrlResult);
744
+ }, 0);
745
+ return;
746
+ }
747
+ var loadSvg = cacheRequests ? loadSvgCached : loadSvgUncached;
748
+ loadSvg(baseUrl, httpRequestWithCredentials, handleLoadedSvg);
696
749
  };
697
750
 
698
751
  var SVGInjector = function (elements, _a) {
@@ -891,7 +944,6 @@
891
944
  var newDesc = document.createElementNS(svgNamespace, 'desc');
892
945
  newDesc.id = descId;
893
946
  newDesc.textContent = desc;
894
- // Insert after <title> if present, otherwise prepend.
895
947
  var existingTitle = svg.querySelector(':scope > title');
896
948
  if (existingTitle) {
897
949
  existingTitle.after(newDesc);