react-svg
Advanced tools
Comparing version 15.1.10 to 15.1.11
@@ -45,3 +45,2 @@ 'use strict'; | ||
} | ||
for (var _i in b) { | ||
@@ -52,3 +51,2 @@ if (a[_i] !== b[_i]) { | ||
} | ||
return false; | ||
@@ -62,10 +60,7 @@ }; | ||
_inheritsLoose__default["default"](ReactSVG, _React$Component); | ||
function ReactSVG() { | ||
var _this; | ||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this; | ||
@@ -80,33 +75,25 @@ _this.initialState = { | ||
_this.nonReactWrapper = void 0; | ||
_this.refCallback = function (reactWrapper) { | ||
_this.reactWrapper = reactWrapper; | ||
}; | ||
return _this; | ||
} | ||
var _proto = ReactSVG.prototype; | ||
_proto.renderSVG = function renderSVG() { | ||
var _this2 = this; | ||
/* istanbul ignore else */ | ||
if (this.reactWrapper instanceof Node) { | ||
var _this$props = this.props, | ||
beforeInjection = _this$props.beforeInjection, | ||
evalScripts = _this$props.evalScripts, | ||
httpRequestWithCredentials = _this$props.httpRequestWithCredentials, | ||
renumerateIRIElements = _this$props.renumerateIRIElements, | ||
src = _this$props.src, | ||
useRequestCache = _this$props.useRequestCache; | ||
beforeInjection = _this$props.beforeInjection, | ||
evalScripts = _this$props.evalScripts, | ||
httpRequestWithCredentials = _this$props.httpRequestWithCredentials, | ||
renumerateIRIElements = _this$props.renumerateIRIElements, | ||
src = _this$props.src, | ||
useRequestCache = _this$props.useRequestCache; | ||
/* eslint-disable @typescript-eslint/no-non-null-assertion */ | ||
var afterInjection = this.props.afterInjection; | ||
var wrapper = this.props.wrapper; | ||
/* eslint-enable @typescript-eslint/no-non-null-assertion */ | ||
var nonReactWrapper; | ||
var nonReactTarget; | ||
if (wrapper === 'svg') { | ||
@@ -121,11 +108,8 @@ nonReactWrapper = document.createElementNS(svgNamespace, wrapper); | ||
} | ||
nonReactWrapper.appendChild(nonReactTarget); | ||
nonReactTarget.dataset.src = src; | ||
this.nonReactWrapper = this.reactWrapper.appendChild(nonReactWrapper); | ||
var afterEach = function afterEach(error, svg) { | ||
if (error) { | ||
_this2.removeSVG(); | ||
if (!_this2._isMounted) { | ||
@@ -135,6 +119,5 @@ afterInjection(error); | ||
} | ||
} // TODO (Tane): It'd be better to cleanly unsubscribe from SVGInjector | ||
} | ||
// TODO (Tane): It'd be better to cleanly unsubscribe from SVGInjector | ||
// callbacks instead of tracking a property like this. | ||
if (_this2._isMounted) { | ||
@@ -151,3 +134,2 @@ _this2.setState(function () { | ||
}; | ||
svgInjector.SVGInjector(nonReactTarget, { | ||
@@ -163,6 +145,4 @@ afterEach: afterEach, | ||
}; | ||
_proto.removeSVG = function removeSVG() { | ||
var _this$nonReactWrapper; | ||
if ((_this$nonReactWrapper = this.nonReactWrapper) != null && _this$nonReactWrapper.parentNode) { | ||
@@ -173,3 +153,2 @@ this.nonReactWrapper.parentNode.removeChild(this.nonReactWrapper); | ||
}; | ||
_proto.componentDidMount = function componentDidMount() { | ||
@@ -179,6 +158,4 @@ this._isMounted = true; | ||
}; | ||
_proto.componentDidUpdate = function componentDidUpdate(prevProps) { | ||
var _this3 = this; | ||
if (shallowDiffers(prevProps, this.props)) { | ||
@@ -189,3 +166,2 @@ this.setState(function () { | ||
_this3.removeSVG(); | ||
_this3.renderSVG(); | ||
@@ -195,3 +171,2 @@ }); | ||
}; | ||
_proto.componentWillUnmount = function componentWillUnmount() { | ||
@@ -201,21 +176,18 @@ this._isMounted = false; | ||
}; | ||
_proto.render = function render() { | ||
/* eslint-disable @typescript-eslint/no-unused-vars */ | ||
var _this$props2 = this.props; | ||
_this$props2.afterInjection; | ||
_this$props2.beforeInjection; | ||
_this$props2.evalScripts; | ||
var Fallback = _this$props2.fallback; | ||
_this$props2.httpRequestWithCredentials; | ||
var Loading = _this$props2.loading; | ||
_this$props2.renumerateIRIElements; | ||
_this$props2.src; | ||
_this$props2.useRequestCache; | ||
var wrapper = _this$props2.wrapper, | ||
rest = _objectWithoutPropertiesLoose__default["default"](_this$props2, _excluded); | ||
_this$props2.afterInjection; | ||
_this$props2.beforeInjection; | ||
_this$props2.evalScripts; | ||
var Fallback = _this$props2.fallback; | ||
_this$props2.httpRequestWithCredentials; | ||
var Loading = _this$props2.loading; | ||
_this$props2.renumerateIRIElements; | ||
_this$props2.src; | ||
_this$props2.useRequestCache; | ||
var wrapper = _this$props2.wrapper, | ||
rest = _objectWithoutPropertiesLoose__default["default"](_this$props2, _excluded); | ||
/* eslint-enable @typescript-eslint/no-unused-vars */ | ||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion | ||
var Wrapper = wrapper; | ||
@@ -229,3 +201,2 @@ return /*#__PURE__*/React__namespace.createElement(Wrapper, _extends__default["default"]({}, rest, { | ||
}; | ||
return ReactSVG; | ||
@@ -232,0 +203,0 @@ }(React__namespace.Component); |
@@ -15,3 +15,2 @@ import _extends from '@babel/runtime/helpers/extends'; | ||
} | ||
for (var _i in b) { | ||
@@ -22,3 +21,2 @@ if (a[_i] !== b[_i]) { | ||
} | ||
return false; | ||
@@ -32,10 +30,7 @@ }; | ||
_inheritsLoose(ReactSVG, _React$Component); | ||
function ReactSVG() { | ||
var _this; | ||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this; | ||
@@ -50,33 +45,25 @@ _this.initialState = { | ||
_this.nonReactWrapper = void 0; | ||
_this.refCallback = function (reactWrapper) { | ||
_this.reactWrapper = reactWrapper; | ||
}; | ||
return _this; | ||
} | ||
var _proto = ReactSVG.prototype; | ||
_proto.renderSVG = function renderSVG() { | ||
var _this2 = this; | ||
/* istanbul ignore else */ | ||
if (this.reactWrapper instanceof Node) { | ||
var _this$props = this.props, | ||
beforeInjection = _this$props.beforeInjection, | ||
evalScripts = _this$props.evalScripts, | ||
httpRequestWithCredentials = _this$props.httpRequestWithCredentials, | ||
renumerateIRIElements = _this$props.renumerateIRIElements, | ||
src = _this$props.src, | ||
useRequestCache = _this$props.useRequestCache; | ||
beforeInjection = _this$props.beforeInjection, | ||
evalScripts = _this$props.evalScripts, | ||
httpRequestWithCredentials = _this$props.httpRequestWithCredentials, | ||
renumerateIRIElements = _this$props.renumerateIRIElements, | ||
src = _this$props.src, | ||
useRequestCache = _this$props.useRequestCache; | ||
/* eslint-disable @typescript-eslint/no-non-null-assertion */ | ||
var afterInjection = this.props.afterInjection; | ||
var wrapper = this.props.wrapper; | ||
/* eslint-enable @typescript-eslint/no-non-null-assertion */ | ||
var nonReactWrapper; | ||
var nonReactTarget; | ||
if (wrapper === 'svg') { | ||
@@ -91,11 +78,8 @@ nonReactWrapper = document.createElementNS(svgNamespace, wrapper); | ||
} | ||
nonReactWrapper.appendChild(nonReactTarget); | ||
nonReactTarget.dataset.src = src; | ||
this.nonReactWrapper = this.reactWrapper.appendChild(nonReactWrapper); | ||
var afterEach = function afterEach(error, svg) { | ||
if (error) { | ||
_this2.removeSVG(); | ||
if (!_this2._isMounted) { | ||
@@ -105,6 +89,5 @@ afterInjection(error); | ||
} | ||
} // TODO (Tane): It'd be better to cleanly unsubscribe from SVGInjector | ||
} | ||
// TODO (Tane): It'd be better to cleanly unsubscribe from SVGInjector | ||
// callbacks instead of tracking a property like this. | ||
if (_this2._isMounted) { | ||
@@ -121,3 +104,2 @@ _this2.setState(function () { | ||
}; | ||
SVGInjector(nonReactTarget, { | ||
@@ -133,6 +115,4 @@ afterEach: afterEach, | ||
}; | ||
_proto.removeSVG = function removeSVG() { | ||
var _this$nonReactWrapper; | ||
if ((_this$nonReactWrapper = this.nonReactWrapper) != null && _this$nonReactWrapper.parentNode) { | ||
@@ -143,3 +123,2 @@ this.nonReactWrapper.parentNode.removeChild(this.nonReactWrapper); | ||
}; | ||
_proto.componentDidMount = function componentDidMount() { | ||
@@ -149,6 +128,4 @@ this._isMounted = true; | ||
}; | ||
_proto.componentDidUpdate = function componentDidUpdate(prevProps) { | ||
var _this3 = this; | ||
if (shallowDiffers(prevProps, this.props)) { | ||
@@ -159,3 +136,2 @@ this.setState(function () { | ||
_this3.removeSVG(); | ||
_this3.renderSVG(); | ||
@@ -165,3 +141,2 @@ }); | ||
}; | ||
_proto.componentWillUnmount = function componentWillUnmount() { | ||
@@ -171,21 +146,18 @@ this._isMounted = false; | ||
}; | ||
_proto.render = function render() { | ||
/* eslint-disable @typescript-eslint/no-unused-vars */ | ||
var _this$props2 = this.props; | ||
_this$props2.afterInjection; | ||
_this$props2.beforeInjection; | ||
_this$props2.evalScripts; | ||
var Fallback = _this$props2.fallback; | ||
_this$props2.httpRequestWithCredentials; | ||
var Loading = _this$props2.loading; | ||
_this$props2.renumerateIRIElements; | ||
_this$props2.src; | ||
_this$props2.useRequestCache; | ||
var wrapper = _this$props2.wrapper, | ||
rest = _objectWithoutPropertiesLoose(_this$props2, _excluded); | ||
_this$props2.afterInjection; | ||
_this$props2.beforeInjection; | ||
_this$props2.evalScripts; | ||
var Fallback = _this$props2.fallback; | ||
_this$props2.httpRequestWithCredentials; | ||
var Loading = _this$props2.loading; | ||
_this$props2.renumerateIRIElements; | ||
_this$props2.src; | ||
_this$props2.useRequestCache; | ||
var wrapper = _this$props2.wrapper, | ||
rest = _objectWithoutPropertiesLoose(_this$props2, _excluded); | ||
/* eslint-enable @typescript-eslint/no-unused-vars */ | ||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion | ||
var Wrapper = wrapper; | ||
@@ -199,3 +171,2 @@ return /*#__PURE__*/React.createElement(Wrapper, _extends({}, rest, { | ||
}; | ||
return ReactSVG; | ||
@@ -202,0 +173,0 @@ }(React.Component); |
@@ -32,3 +32,2 @@ (function (global, factory) { | ||
var source = arguments[i]; | ||
for (var key in source) { | ||
@@ -40,3 +39,2 @@ if (Object.prototype.hasOwnProperty.call(source, key)) { | ||
} | ||
return target; | ||
@@ -52,3 +50,2 @@ }; | ||
var key, i; | ||
for (i = 0; i < sourceKeys.length; i++) { | ||
@@ -59,3 +56,2 @@ key = sourceKeys[i]; | ||
} | ||
return target; | ||
@@ -622,3 +618,2 @@ } | ||
} | ||
for (var _i in b) { | ||
@@ -629,3 +624,2 @@ if (a[_i] !== b[_i]) { | ||
} | ||
return false; | ||
@@ -639,10 +633,7 @@ }; | ||
_inheritsLoose(ReactSVG, _React$Component); | ||
function ReactSVG() { | ||
var _this; | ||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this; | ||
@@ -657,33 +648,25 @@ _this.initialState = { | ||
_this.nonReactWrapper = void 0; | ||
_this.refCallback = function (reactWrapper) { | ||
_this.reactWrapper = reactWrapper; | ||
}; | ||
return _this; | ||
} | ||
var _proto = ReactSVG.prototype; | ||
_proto.renderSVG = function renderSVG() { | ||
var _this2 = this; | ||
/* istanbul ignore else */ | ||
if (this.reactWrapper instanceof Node) { | ||
var _this$props = this.props, | ||
beforeInjection = _this$props.beforeInjection, | ||
evalScripts = _this$props.evalScripts, | ||
httpRequestWithCredentials = _this$props.httpRequestWithCredentials, | ||
renumerateIRIElements = _this$props.renumerateIRIElements, | ||
src = _this$props.src, | ||
useRequestCache = _this$props.useRequestCache; | ||
beforeInjection = _this$props.beforeInjection, | ||
evalScripts = _this$props.evalScripts, | ||
httpRequestWithCredentials = _this$props.httpRequestWithCredentials, | ||
renumerateIRIElements = _this$props.renumerateIRIElements, | ||
src = _this$props.src, | ||
useRequestCache = _this$props.useRequestCache; | ||
/* eslint-disable @typescript-eslint/no-non-null-assertion */ | ||
var afterInjection = this.props.afterInjection; | ||
var wrapper = this.props.wrapper; | ||
/* eslint-enable @typescript-eslint/no-non-null-assertion */ | ||
var nonReactWrapper; | ||
var nonReactTarget; | ||
if (wrapper === 'svg') { | ||
@@ -698,11 +681,8 @@ nonReactWrapper = document.createElementNS(svgNamespace, wrapper); | ||
} | ||
nonReactWrapper.appendChild(nonReactTarget); | ||
nonReactTarget.dataset.src = src; | ||
this.nonReactWrapper = this.reactWrapper.appendChild(nonReactWrapper); | ||
var afterEach = function afterEach(error, svg) { | ||
if (error) { | ||
_this2.removeSVG(); | ||
if (!_this2._isMounted) { | ||
@@ -712,6 +692,5 @@ afterInjection(error); | ||
} | ||
} // TODO (Tane): It'd be better to cleanly unsubscribe from SVGInjector | ||
} | ||
// TODO (Tane): It'd be better to cleanly unsubscribe from SVGInjector | ||
// callbacks instead of tracking a property like this. | ||
if (_this2._isMounted) { | ||
@@ -728,3 +707,2 @@ _this2.setState(function () { | ||
}; | ||
SVGInjector(nonReactTarget, { | ||
@@ -740,6 +718,4 @@ afterEach: afterEach, | ||
}; | ||
_proto.removeSVG = function removeSVG() { | ||
var _this$nonReactWrapper; | ||
if ((_this$nonReactWrapper = this.nonReactWrapper) != null && _this$nonReactWrapper.parentNode) { | ||
@@ -750,3 +726,2 @@ this.nonReactWrapper.parentNode.removeChild(this.nonReactWrapper); | ||
}; | ||
_proto.componentDidMount = function componentDidMount() { | ||
@@ -756,6 +731,4 @@ this._isMounted = true; | ||
}; | ||
_proto.componentDidUpdate = function componentDidUpdate(prevProps) { | ||
var _this3 = this; | ||
if (shallowDiffers(prevProps, this.props)) { | ||
@@ -766,3 +739,2 @@ this.setState(function () { | ||
_this3.removeSVG(); | ||
_this3.renderSVG(); | ||
@@ -772,3 +744,2 @@ }); | ||
}; | ||
_proto.componentWillUnmount = function componentWillUnmount() { | ||
@@ -778,21 +749,18 @@ this._isMounted = false; | ||
}; | ||
_proto.render = function render() { | ||
/* eslint-disable @typescript-eslint/no-unused-vars */ | ||
var _this$props2 = this.props; | ||
_this$props2.afterInjection; | ||
_this$props2.beforeInjection; | ||
_this$props2.evalScripts; | ||
var Fallback = _this$props2.fallback; | ||
_this$props2.httpRequestWithCredentials; | ||
var Loading = _this$props2.loading; | ||
_this$props2.renumerateIRIElements; | ||
_this$props2.src; | ||
_this$props2.useRequestCache; | ||
var wrapper = _this$props2.wrapper, | ||
rest = _objectWithoutPropertiesLoose(_this$props2, _excluded); | ||
_this$props2.afterInjection; | ||
_this$props2.beforeInjection; | ||
_this$props2.evalScripts; | ||
var Fallback = _this$props2.fallback; | ||
_this$props2.httpRequestWithCredentials; | ||
var Loading = _this$props2.loading; | ||
_this$props2.renumerateIRIElements; | ||
_this$props2.src; | ||
_this$props2.useRequestCache; | ||
var wrapper = _this$props2.wrapper, | ||
rest = _objectWithoutPropertiesLoose(_this$props2, _excluded); | ||
/* eslint-enable @typescript-eslint/no-unused-vars */ | ||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion | ||
var Wrapper = wrapper; | ||
@@ -806,3 +774,2 @@ return /*#__PURE__*/React__namespace.createElement(Wrapper, _extends({}, rest, { | ||
}; | ||
return ReactSVG; | ||
@@ -809,0 +776,0 @@ }(React__namespace.Component); |
{ | ||
"name": "react-svg", | ||
"version": "15.1.10", | ||
"version": "15.1.11", | ||
"description": "A React component that injects SVG into the DOM.", | ||
@@ -58,4 +58,4 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@babel/runtime": "^7.19.0", | ||
"@tanem/svg-injector": "^10.1.33", | ||
"@babel/runtime": "^7.19.4", | ||
"@tanem/svg-injector": "^10.1.34", | ||
"@types/prop-types": "^15.7.5", | ||
@@ -65,29 +65,29 @@ "prop-types": "^15.8.1" | ||
"devDependencies": { | ||
"@babel/core": "7.19.3", | ||
"@babel/plugin-transform-runtime": "7.19.1", | ||
"@babel/preset-env": "7.19.3", | ||
"@babel/core": "7.19.6", | ||
"@babel/plugin-transform-runtime": "7.19.6", | ||
"@babel/preset-env": "7.19.4", | ||
"@babel/preset-react": "7.18.6", | ||
"@rollup/plugin-babel": "5.3.1", | ||
"@rollup/plugin-commonjs": "22.0.2", | ||
"@rollup/plugin-node-resolve": "14.1.0", | ||
"@rollup/plugin-replace": "4.0.0", | ||
"@rollup/plugin-babel": "6.0.2", | ||
"@rollup/plugin-commonjs": "23.0.2", | ||
"@rollup/plugin-node-resolve": "15.0.1", | ||
"@rollup/plugin-replace": "5.0.1", | ||
"@testing-library/react": "13.4.0", | ||
"@types/faker": "5.5.9", | ||
"@types/jest": "29.1.1", | ||
"@types/jest": "29.2.0", | ||
"@types/jsdom": "20.0.0", | ||
"@types/react": "18.0.21", | ||
"@types/react-dom": "18.0.6", | ||
"@types/react": "18.0.23", | ||
"@types/react-dom": "18.0.7", | ||
"@types/shelljs": "0.8.11", | ||
"@typescript-eslint/eslint-plugin": "5.39.0", | ||
"@typescript-eslint/parser": "5.39.0", | ||
"@typescript-eslint/eslint-plugin": "5.41.0", | ||
"@typescript-eslint/parser": "5.41.0", | ||
"babel-core": "6.26.3", | ||
"babel-plugin-transform-react-remove-prop-types": "0.4.24", | ||
"eslint": "8.24.0", | ||
"eslint": "8.26.0", | ||
"eslint-config-prettier": "8.5.0", | ||
"eslint-plugin-react": "7.31.8", | ||
"eslint-plugin-react": "7.31.10", | ||
"eslint-plugin-react-hooks": "4.6.0", | ||
"eslint-plugin-simple-import-sort": "8.0.0", | ||
"faker": "5.5.3", | ||
"jest": "29.1.2", | ||
"jest-environment-jsdom": "29.1.2", | ||
"jest": "29.2.2", | ||
"jest-environment-jsdom": "29.2.2", | ||
"jest-prettyhtml-matchers": "1.12.1", | ||
@@ -104,3 +104,3 @@ "nock": "13.2.9", | ||
"shx": "0.3.4", | ||
"tanem-scripts": "6.0.60", | ||
"tanem-scripts": "6.0.61", | ||
"ts-jest": "29.0.3", | ||
@@ -107,0 +107,0 @@ "ts-node": "10.9.1", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1221
230342
Updated@babel/runtime@^7.19.4
Updated@tanem/svg-injector@^10.1.34