react-svg 16.1.33 → 16.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -24,46 +24,34 @@
24
24
  var PropTypes__namespace = /*#__PURE__*/_interopNamespaceDefault(PropTypes);
25
25
  var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
26
26
 
27
- function _objectWithoutPropertiesLoose(source, excluded) {
28
- if (source == null) return {};
29
- var target = {};
30
- var sourceKeys = Object.keys(source);
31
- var key, i;
32
- for (i = 0; i < sourceKeys.length; i++) {
33
- key = sourceKeys[i];
34
- if (excluded.indexOf(key) >= 0) continue;
35
- target[key] = source[key];
27
+ function _objectWithoutPropertiesLoose(r, e) {
28
+ if (null == r) return {};
29
+ var t = {};
30
+ for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
31
+ if (e.includes(n)) continue;
32
+ t[n] = r[n];
36
33
  }
37
- return target;
34
+ return t;
38
35
  }
39
36
 
40
37
  function _extends() {
41
- _extends = Object.assign ? Object.assign.bind() : function (target) {
42
- for (var i = 1; i < arguments.length; i++) {
43
- var source = arguments[i];
44
- for (var key in source) {
45
- if (Object.prototype.hasOwnProperty.call(source, key)) {
46
- target[key] = source[key];
47
- }
48
- }
38
+ return _extends = Object.assign ? Object.assign.bind() : function (n) {
39
+ for (var e = 1; e < arguments.length; e++) {
40
+ var t = arguments[e];
41
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
49
42
  }
50
- return target;
51
- };
52
- return _extends.apply(this, arguments);
43
+ return n;
44
+ }, _extends.apply(null, arguments);
53
45
  }
54
46
 
55
- function _setPrototypeOf(o, p) {
56
- _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
57
- o.__proto__ = p;
58
- return o;
59
- };
60
- return _setPrototypeOf(o, p);
47
+ function _setPrototypeOf(t, e) {
48
+ return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
49
+ return t.__proto__ = e, t;
50
+ }, _setPrototypeOf(t, e);
61
51
  }
62
52
 
63
- function _inheritsLoose(subClass, superClass) {
64
- subClass.prototype = Object.create(superClass.prototype);
65
- subClass.prototype.constructor = subClass;
66
- _setPrototypeOf(subClass, superClass);
53
+ function _inheritsLoose(t, o) {
54
+ t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);
67
55
  }
68
56
 
69
57
  /******************************************************************************
@@ -98,151 +86,241 @@
98
86
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
99
87
  };
100
88
 
89
+ var contentType = {};
90
+
101
91
  /*!
102
92
  * content-type
103
93
  * Copyright(c) 2015 Douglas Christopher Wilson
104
94
  * MIT Licensed
105
95
  */
106
96
 
107
- /**
108
- * RegExp to match *( ";" parameter ) in RFC 7231 sec 3.1.1.1
109
- *
110
- * parameter = token "=" ( token / quoted-string )
111
- * token = 1*tchar
112
- * tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*"
113
- * / "+" / "-" / "." / "^" / "_" / "`" / "|" / "~"
114
- * / DIGIT / ALPHA
115
- * ; any VCHAR, except delimiters
116
- * quoted-string = DQUOTE *( qdtext / quoted-pair ) DQUOTE
117
- * qdtext = HTAB / SP / %x21 / %x23-5B / %x5D-7E / obs-text
118
- * obs-text = %x80-FF
119
- * quoted-pair = "\" ( HTAB / SP / VCHAR / obs-text )
120
- */
121
- var PARAM_REGEXP = /; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g; // eslint-disable-line no-control-regex
122
-
123
- /**
124
- * RegExp to match quoted-pair in RFC 7230 sec 3.2.6
125
- *
126
- * quoted-pair = "\" ( HTAB / SP / VCHAR / obs-text )
127
- * obs-text = %x80-FF
128
- */
129
- var QESC_REGEXP = /\\([\u000b\u0020-\u00ff])/g; // eslint-disable-line no-control-regex
130
-
131
- /**
132
- * RegExp to match type in RFC 7231 sec 3.1.1.1
133
- *
134
- * media-type = type "/" subtype
135
- * type = token
136
- * subtype = token
137
- */
138
- var TYPE_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
139
- var parse_1 = parse;
140
-
141
- /**
142
- * Parse media type to object.
143
- *
144
- * @param {string|object} string
145
- * @return {Object}
146
- * @public
147
- */
148
-
149
- function parse (string) {
150
- if (!string) {
151
- throw new TypeError('argument string is required')
152
- }
153
-
154
- // support req/res-like objects as argument
155
- var header = typeof string === 'object'
156
- ? getcontenttype(string)
157
- : string;
158
-
159
- if (typeof header !== 'string') {
160
- throw new TypeError('argument string is required to be a string')
161
- }
162
-
163
- var index = header.indexOf(';');
164
- var type = index !== -1
165
- ? header.slice(0, index).trim()
166
- : header.trim();
167
-
168
- if (!TYPE_REGEXP.test(type)) {
169
- throw new TypeError('invalid media type')
170
- }
171
-
172
- var obj = new ContentType(type.toLowerCase());
173
-
174
- // parse parameters
175
- if (index !== -1) {
176
- var key;
177
- var match;
178
- var value;
179
-
180
- PARAM_REGEXP.lastIndex = index;
181
-
182
- while ((match = PARAM_REGEXP.exec(header))) {
183
- if (match.index !== index) {
184
- throw new TypeError('invalid parameter format')
185
- }
186
-
187
- index += match[0].length;
188
- key = match[1].toLowerCase();
189
- value = match[2];
190
-
191
- if (value.charCodeAt(0) === 0x22 /* " */) {
192
- // remove quotes
193
- value = value.slice(1, -1);
194
-
195
- // remove escapes
196
- if (value.indexOf('\\') !== -1) {
197
- value = value.replace(QESC_REGEXP, '$1');
198
- }
199
- }
200
-
201
- obj.parameters[key] = value;
202
- }
203
-
204
- if (index !== header.length) {
205
- throw new TypeError('invalid parameter format')
206
- }
207
- }
208
-
209
- return obj
97
+ var hasRequiredContentType;
98
+
99
+ function requireContentType () {
100
+ if (hasRequiredContentType) return contentType;
101
+ hasRequiredContentType = 1;
102
+
103
+ /**
104
+ * RegExp to match *( ";" parameter ) in RFC 7231 sec 3.1.1.1
105
+ *
106
+ * parameter = token "=" ( token / quoted-string )
107
+ * token = 1*tchar
108
+ * tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*"
109
+ * / "+" / "-" / "." / "^" / "_" / "`" / "|" / "~"
110
+ * / DIGIT / ALPHA
111
+ * ; any VCHAR, except delimiters
112
+ * quoted-string = DQUOTE *( qdtext / quoted-pair ) DQUOTE
113
+ * qdtext = HTAB / SP / %x21 / %x23-5B / %x5D-7E / obs-text
114
+ * obs-text = %x80-FF
115
+ * quoted-pair = "\" ( HTAB / SP / VCHAR / obs-text )
116
+ */
117
+ var PARAM_REGEXP = /; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g; // eslint-disable-line no-control-regex
118
+ var TEXT_REGEXP = /^[\u000b\u0020-\u007e\u0080-\u00ff]+$/; // eslint-disable-line no-control-regex
119
+ var TOKEN_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
120
+
121
+ /**
122
+ * RegExp to match quoted-pair in RFC 7230 sec 3.2.6
123
+ *
124
+ * quoted-pair = "\" ( HTAB / SP / VCHAR / obs-text )
125
+ * obs-text = %x80-FF
126
+ */
127
+ var QESC_REGEXP = /\\([\u000b\u0020-\u00ff])/g; // eslint-disable-line no-control-regex
128
+
129
+ /**
130
+ * RegExp to match chars that must be quoted-pair in RFC 7230 sec 3.2.6
131
+ */
132
+ var QUOTE_REGEXP = /([\\"])/g;
133
+
134
+ /**
135
+ * RegExp to match type in RFC 7231 sec 3.1.1.1
136
+ *
137
+ * media-type = type "/" subtype
138
+ * type = token
139
+ * subtype = token
140
+ */
141
+ var TYPE_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
142
+
143
+ /**
144
+ * Module exports.
145
+ * @public
146
+ */
147
+
148
+ contentType.format = format;
149
+ contentType.parse = parse;
150
+
151
+ /**
152
+ * Format object to media type.
153
+ *
154
+ * @param {object} obj
155
+ * @return {string}
156
+ * @public
157
+ */
158
+
159
+ function format (obj) {
160
+ if (!obj || typeof obj !== 'object') {
161
+ throw new TypeError('argument obj is required')
162
+ }
163
+
164
+ var parameters = obj.parameters;
165
+ var type = obj.type;
166
+
167
+ if (!type || !TYPE_REGEXP.test(type)) {
168
+ throw new TypeError('invalid type')
169
+ }
170
+
171
+ var string = type;
172
+
173
+ // append parameters
174
+ if (parameters && typeof parameters === 'object') {
175
+ var param;
176
+ var params = Object.keys(parameters).sort();
177
+
178
+ for (var i = 0; i < params.length; i++) {
179
+ param = params[i];
180
+
181
+ if (!TOKEN_REGEXP.test(param)) {
182
+ throw new TypeError('invalid parameter name')
183
+ }
184
+
185
+ string += '; ' + param + '=' + qstring(parameters[param]);
186
+ }
187
+ }
188
+
189
+ return string
190
+ }
191
+
192
+ /**
193
+ * Parse media type to object.
194
+ *
195
+ * @param {string|object} string
196
+ * @return {Object}
197
+ * @public
198
+ */
199
+
200
+ function parse (string) {
201
+ if (!string) {
202
+ throw new TypeError('argument string is required')
203
+ }
204
+
205
+ // support req/res-like objects as argument
206
+ var header = typeof string === 'object'
207
+ ? getcontenttype(string)
208
+ : string;
209
+
210
+ if (typeof header !== 'string') {
211
+ throw new TypeError('argument string is required to be a string')
212
+ }
213
+
214
+ var index = header.indexOf(';');
215
+ var type = index !== -1
216
+ ? header.slice(0, index).trim()
217
+ : header.trim();
218
+
219
+ if (!TYPE_REGEXP.test(type)) {
220
+ throw new TypeError('invalid media type')
221
+ }
222
+
223
+ var obj = new ContentType(type.toLowerCase());
224
+
225
+ // parse parameters
226
+ if (index !== -1) {
227
+ var key;
228
+ var match;
229
+ var value;
230
+
231
+ PARAM_REGEXP.lastIndex = index;
232
+
233
+ while ((match = PARAM_REGEXP.exec(header))) {
234
+ if (match.index !== index) {
235
+ throw new TypeError('invalid parameter format')
236
+ }
237
+
238
+ index += match[0].length;
239
+ key = match[1].toLowerCase();
240
+ value = match[2];
241
+
242
+ if (value.charCodeAt(0) === 0x22 /* " */) {
243
+ // remove quotes
244
+ value = value.slice(1, -1);
245
+
246
+ // remove escapes
247
+ if (value.indexOf('\\') !== -1) {
248
+ value = value.replace(QESC_REGEXP, '$1');
249
+ }
250
+ }
251
+
252
+ obj.parameters[key] = value;
253
+ }
254
+
255
+ if (index !== header.length) {
256
+ throw new TypeError('invalid parameter format')
257
+ }
258
+ }
259
+
260
+ return obj
261
+ }
262
+
263
+ /**
264
+ * Get content-type from req/res objects.
265
+ *
266
+ * @param {object}
267
+ * @return {Object}
268
+ * @private
269
+ */
270
+
271
+ function getcontenttype (obj) {
272
+ var header;
273
+
274
+ if (typeof obj.getHeader === 'function') {
275
+ // res-like
276
+ header = obj.getHeader('content-type');
277
+ } else if (typeof obj.headers === 'object') {
278
+ // req-like
279
+ header = obj.headers && obj.headers['content-type'];
280
+ }
281
+
282
+ if (typeof header !== 'string') {
283
+ throw new TypeError('content-type header is missing from object')
284
+ }
285
+
286
+ return header
287
+ }
288
+
289
+ /**
290
+ * Quote a string if necessary.
291
+ *
292
+ * @param {string} val
293
+ * @return {string}
294
+ * @private
295
+ */
296
+
297
+ function qstring (val) {
298
+ var str = String(val);
299
+
300
+ // no need to quote tokens
301
+ if (TOKEN_REGEXP.test(str)) {
302
+ return str
303
+ }
304
+
305
+ if (str.length > 0 && !TEXT_REGEXP.test(str)) {
306
+ throw new TypeError('invalid parameter value')
307
+ }
308
+
309
+ return '"' + str.replace(QUOTE_REGEXP, '\\$1') + '"'
310
+ }
311
+
312
+ /**
313
+ * Class to represent a content type.
314
+ * @private
315
+ */
316
+ function ContentType (type) {
317
+ this.parameters = Object.create(null);
318
+ this.type = type;
319
+ }
320
+ return contentType;
210
321
  }
211
322
 
212
- /**
213
- * Get content-type from req/res objects.
214
- *
215
- * @param {object}
216
- * @return {Object}
217
- * @private
218
- */
219
-
220
- function getcontenttype (obj) {
221
- var header;
222
-
223
- if (typeof obj.getHeader === 'function') {
224
- // res-like
225
- header = obj.getHeader('content-type');
226
- } else if (typeof obj.headers === 'object') {
227
- // req-like
228
- header = obj.headers && obj.headers['content-type'];
229
- }
230
-
231
- if (typeof header !== 'string') {
232
- throw new TypeError('content-type header is missing from object')
233
- }
234
-
235
- return header
236
- }
237
-
238
- /**
239
- * Class to represent a content type.
240
- * @private
241
- */
242
- function ContentType (type) {
243
- this.parameters = Object.create(null);
244
- this.type = type;
245
- }
323
+ var contentTypeExports = requireContentType();
246
324
 
247
325
  var cache = new Map();
248
326
 
@@ -263,7 +341,7 @@
263
341
  if (!contentType) {
264
342
  throw new Error('Content type not found');
265
343
  }
266
- var type = parse_1(contentType).type;
344
+ var type = contentTypeExports.parse(contentType).type;
267
345
  if (!(type === 'image/svg+xml' || type === 'text/plain')) {
268
346
  throw new Error("Invalid content type: ".concat(type));
269
347
  }
@@ -583,7 +661,6 @@
583
661
  var svgNamespace = 'http://www.w3.org/2000/svg';
584
662
  var xlinkNamespace = 'http://www.w3.org/1999/xlink';
585
663
  var ReactSVG = /*#__PURE__*/function (_React$Component) {
586
- _inheritsLoose(ReactSVG, _React$Component);
587
664
  function ReactSVG() {
588
665
  var _this;
589
666
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
@@ -603,6 +680,7 @@
603
680
  };
604
681
  return _this;
605
682
  }
683
+ _inheritsLoose(ReactSVG, _React$Component);
606
684
  var _proto = ReactSVG.prototype;
607
685
  _proto.renderSVG = function renderSVG() {
608
686
  var _this2 = this;