react-inlinesvg 3.0.3 → 3.1.0-0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/esm/helpers.js DELETED
@@ -1,58 +0,0 @@
1
- import { canUseDOM as canUseDOMFlag } from 'exenv';
2
- export var STATUS = {
3
- IDLE: 'idle',
4
- LOADING: 'loading',
5
- LOADED: 'loaded',
6
- FAILED: 'failed',
7
- READY: 'ready',
8
- UNSUPPORTED: 'unsupported',
9
- };
10
- export function canUseDOM() {
11
- return canUseDOMFlag;
12
- }
13
- export function isSupportedEnvironment() {
14
- return supportsInlineSVG() && typeof window !== 'undefined' && window !== null;
15
- }
16
- export function supportsInlineSVG() {
17
- /* istanbul ignore next */
18
- if (!document) {
19
- return false;
20
- }
21
- var div = document.createElement('div');
22
- div.innerHTML = '<svg />';
23
- var svg = div.firstChild;
24
- return !!svg && svg.namespaceURI === 'http://www.w3.org/2000/svg';
25
- }
26
- function randomCharacter(character) {
27
- return character[Math.floor(Math.random() * character.length)];
28
- }
29
- export function randomString(length) {
30
- var letters = 'abcdefghijklmnopqrstuvwxyz';
31
- var numbers = '1234567890';
32
- var charset = "".concat(letters).concat(letters.toUpperCase()).concat(numbers);
33
- var R = '';
34
- for (var index = 0; index < length; index++) {
35
- R += randomCharacter(charset);
36
- }
37
- return R;
38
- }
39
- /**
40
- * Remove properties from an object
41
- */
42
- export function omit(input) {
43
- var filter = [];
44
- for (var _i = 1; _i < arguments.length; _i++) {
45
- filter[_i - 1] = arguments[_i];
46
- }
47
- var output = {};
48
- for (var key in input) {
49
- /* istanbul ignore else */
50
- if ({}.hasOwnProperty.call(input, key)) {
51
- if (!filter.includes(key)) {
52
- output[key] = input[key];
53
- }
54
- }
55
- }
56
- return output;
57
- }
58
- //# sourceMappingURL=helpers.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAA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,EAAE,EAAE;QAC3C,CAAC,IAAI,eAAe,CAAC,OAAO,CAAC,CAAC;KAC/B;IAED,OAAO,CAAC,CAAC;AACX,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,IAAI,CAClB,KAAQ;IACR,gBAAc;SAAd,UAAc,EAAd,qBAAc,EAAd,IAAc;QAAd,+BAAc;;IAEd,IAAM,MAAM,GAAQ,EAAE,CAAC;IAEvB,KAAK,IAAM,GAAG,IAAI,KAAK,EAAE;QACvB,0BAA0B;QAC1B,IAAI,EAAE,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE;YACtC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAmB,CAAC,EAAE;gBACzC,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;aAC1B;SACF;KACF;IAED,OAAO,MAAoB,CAAC;AAC9B,CAAC"}
package/esm/index.d.ts DELETED
@@ -1,28 +0,0 @@
1
- import * as React from 'react';
2
- import { Props, State, StorageItem } from './types';
3
- export declare const cacheStore: {
4
- [key: string]: StorageItem;
5
- };
6
- export default class InlineSVG extends React.PureComponent<Props, State> {
7
- private readonly hash;
8
- private isActive;
9
- private isInitialized;
10
- static defaultProps: {
11
- cacheRequests: boolean;
12
- uniquifyIDs: boolean;
13
- };
14
- constructor(props: Props);
15
- componentDidMount(): void;
16
- componentDidUpdate(previousProps: Props, previousState: State): void;
17
- componentWillUnmount(): void;
18
- private getElement;
19
- private getNode;
20
- private handleError;
21
- private handleLoad;
22
- private load;
23
- private processSVG;
24
- private request;
25
- private updateSVGAttributes;
26
- render(): React.ReactNode;
27
- }
28
- export * from './types';
package/esm/index.js DELETED
@@ -1,471 +0,0 @@
1
- var __extends = (this && this.__extends) || (function () {
2
- var extendStatics = function (d, b) {
3
- extendStatics = Object.setPrototypeOf ||
4
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
- return extendStatics(d, b);
7
- };
8
- return function (d, b) {
9
- if (typeof b !== "function" && b !== null)
10
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
11
- extendStatics(d, b);
12
- function __() { this.constructor = d; }
13
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
- };
15
- })();
16
- var __assign = (this && this.__assign) || function () {
17
- __assign = Object.assign || function(t) {
18
- for (var s, i = 1, n = arguments.length; i < n; i++) {
19
- s = arguments[i];
20
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
21
- t[p] = s[p];
22
- }
23
- return t;
24
- };
25
- return __assign.apply(this, arguments);
26
- };
27
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
28
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
29
- return new (P || (P = Promise))(function (resolve, reject) {
30
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
31
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
32
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
33
- step((generator = generator.apply(thisArg, _arguments || [])).next());
34
- });
35
- };
36
- var __generator = (this && this.__generator) || function (thisArg, body) {
37
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
38
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
39
- function verb(n) { return function (v) { return step([n, v]); }; }
40
- function step(op) {
41
- if (f) throw new TypeError("Generator is already executing.");
42
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
43
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
44
- if (y = 0, t) op = [op[0] & 2, t.value];
45
- switch (op[0]) {
46
- case 0: case 1: t = op; break;
47
- case 4: _.label++; return { value: op[1], done: false };
48
- case 5: _.label++; y = op[1]; op = [0]; continue;
49
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
50
- default:
51
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
52
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
53
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
54
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
55
- if (t[2]) _.ops.pop();
56
- _.trys.pop(); continue;
57
- }
58
- op = body.call(thisArg, _);
59
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
60
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
61
- }
62
- };
63
- var __read = (this && this.__read) || function (o, n) {
64
- var m = typeof Symbol === "function" && o[Symbol.iterator];
65
- if (!m) return o;
66
- var i = m.call(o), r, ar = [], e;
67
- try {
68
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
69
- }
70
- catch (error) { e = { error: error }; }
71
- finally {
72
- try {
73
- if (r && !r.done && (m = i["return"])) m.call(i);
74
- }
75
- finally { if (e) throw e.error; }
76
- }
77
- return ar;
78
- };
79
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
80
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
81
- if (ar || !(i in from)) {
82
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
83
- ar[i] = from[i];
84
- }
85
- }
86
- return to.concat(ar || Array.prototype.slice.call(from));
87
- };
88
- import * as React from 'react';
89
- import convert from 'react-from-dom';
90
- import { canUseDOM, isSupportedEnvironment, omit, randomString, STATUS } from './helpers';
91
- export var cacheStore = Object.create(null);
92
- var InlineSVG = /** @class */ (function (_super) {
93
- __extends(InlineSVG, _super);
94
- function InlineSVG(props) {
95
- var _this = _super.call(this, props) || this;
96
- Object.defineProperty(_this, "hash", {
97
- enumerable: true,
98
- configurable: true,
99
- writable: true,
100
- value: void 0
101
- });
102
- Object.defineProperty(_this, "isActive", {
103
- enumerable: true,
104
- configurable: true,
105
- writable: true,
106
- value: false
107
- });
108
- Object.defineProperty(_this, "isInitialized", {
109
- enumerable: true,
110
- configurable: true,
111
- writable: true,
112
- value: false
113
- });
114
- Object.defineProperty(_this, "handleError", {
115
- enumerable: true,
116
- configurable: true,
117
- writable: true,
118
- value: function (error) {
119
- var onError = _this.props.onError;
120
- var status = error.message === 'Browser does not support SVG' ? STATUS.UNSUPPORTED : STATUS.FAILED;
121
- /* istanbul ignore else */
122
- if (_this.isActive) {
123
- _this.setState({ status: status }, function () {
124
- /* istanbul ignore else */
125
- if (typeof onError === 'function') {
126
- onError(error);
127
- }
128
- });
129
- }
130
- }
131
- });
132
- Object.defineProperty(_this, "handleLoad", {
133
- enumerable: true,
134
- configurable: true,
135
- writable: true,
136
- value: function (content, hasCache) {
137
- if (hasCache === void 0) { hasCache = false; }
138
- /* istanbul ignore else */
139
- if (_this.isActive) {
140
- _this.setState({
141
- content: content,
142
- hasCache: hasCache,
143
- status: STATUS.LOADED,
144
- }, _this.getElement);
145
- }
146
- }
147
- });
148
- Object.defineProperty(_this, "request", {
149
- enumerable: true,
150
- configurable: true,
151
- writable: true,
152
- value: function () { return __awaiter(_this, void 0, void 0, function () {
153
- var _a, cacheRequests, fetchOptions, src, response, contentType, _b, fileType_1, content, currentSrc, cache, error_1, cache;
154
- return __generator(this, function (_c) {
155
- switch (_c.label) {
156
- case 0:
157
- _a = this.props, cacheRequests = _a.cacheRequests, fetchOptions = _a.fetchOptions, src = _a.src;
158
- if (cacheRequests) {
159
- cacheStore[src] = { content: '', status: STATUS.LOADING };
160
- }
161
- _c.label = 1;
162
- case 1:
163
- _c.trys.push([1, 4, , 5]);
164
- return [4 /*yield*/, fetch(src, fetchOptions)];
165
- case 2:
166
- response = _c.sent();
167
- contentType = response.headers.get('content-type');
168
- _b = __read((contentType || '').split(/ ?; ?/), 1), fileType_1 = _b[0];
169
- if (response.status > 299) {
170
- throw new Error('Not found');
171
- }
172
- if (!['image/svg+xml', 'text/plain'].some(function (d) { return fileType_1.includes(d); })) {
173
- throw new Error("Content type isn't valid: ".concat(fileType_1));
174
- }
175
- return [4 /*yield*/, response.text()];
176
- case 3:
177
- content = _c.sent();
178
- currentSrc = this.props.src;
179
- // the current src don't match the previous one, skipping...
180
- if (src !== currentSrc) {
181
- if (cacheStore[src].status === STATUS.LOADING) {
182
- delete cacheStore[src];
183
- }
184
- return [2 /*return*/];
185
- }
186
- this.handleLoad(content);
187
- /* istanbul ignore else */
188
- if (cacheRequests) {
189
- cache = cacheStore[src];
190
- /* istanbul ignore else */
191
- if (cache) {
192
- cache.content = content;
193
- cache.status = STATUS.LOADED;
194
- }
195
- }
196
- return [3 /*break*/, 5];
197
- case 4:
198
- error_1 = _c.sent();
199
- this.handleError(error_1);
200
- /* istanbul ignore else */
201
- if (cacheRequests) {
202
- cache = cacheStore[src];
203
- /* istanbul ignore else */
204
- if (cache) {
205
- delete cacheStore[src];
206
- }
207
- }
208
- return [3 /*break*/, 5];
209
- case 5: return [2 /*return*/];
210
- }
211
- });
212
- }); }
213
- });
214
- _this.state = {
215
- content: '',
216
- element: null,
217
- hasCache: !!props.cacheRequests && !!cacheStore[props.src],
218
- status: STATUS.IDLE,
219
- };
220
- _this.hash = props.uniqueHash || randomString(8);
221
- return _this;
222
- }
223
- Object.defineProperty(InlineSVG.prototype, "componentDidMount", {
224
- enumerable: false,
225
- configurable: true,
226
- writable: true,
227
- value: function () {
228
- this.isActive = true;
229
- if (!canUseDOM() || this.isInitialized) {
230
- return;
231
- }
232
- var status = this.state.status;
233
- var src = this.props.src;
234
- try {
235
- /* istanbul ignore else */
236
- if (status === STATUS.IDLE) {
237
- /* istanbul ignore else */
238
- if (!isSupportedEnvironment()) {
239
- throw new Error('Browser does not support SVG');
240
- }
241
- /* istanbul ignore else */
242
- if (!src) {
243
- throw new Error('Missing src');
244
- }
245
- this.load();
246
- }
247
- }
248
- catch (error) {
249
- this.handleError(error);
250
- }
251
- this.isInitialized = true;
252
- }
253
- });
254
- Object.defineProperty(InlineSVG.prototype, "componentDidUpdate", {
255
- enumerable: false,
256
- configurable: true,
257
- writable: true,
258
- value: function (previousProps, previousState) {
259
- if (!canUseDOM()) {
260
- return;
261
- }
262
- var _a = this.state, hasCache = _a.hasCache, status = _a.status;
263
- var _b = this.props, onLoad = _b.onLoad, src = _b.src;
264
- if (previousState.status !== STATUS.READY && status === STATUS.READY) {
265
- /* istanbul ignore else */
266
- if (onLoad) {
267
- onLoad(src, hasCache);
268
- }
269
- }
270
- if (previousProps.src !== src) {
271
- if (!src) {
272
- this.handleError(new Error('Missing src'));
273
- return;
274
- }
275
- this.load();
276
- }
277
- }
278
- });
279
- Object.defineProperty(InlineSVG.prototype, "componentWillUnmount", {
280
- enumerable: false,
281
- configurable: true,
282
- writable: true,
283
- value: function () {
284
- this.isActive = false;
285
- }
286
- });
287
- Object.defineProperty(InlineSVG.prototype, "getElement", {
288
- enumerable: false,
289
- configurable: true,
290
- writable: true,
291
- value: function () {
292
- try {
293
- var node = this.getNode();
294
- var element = convert(node);
295
- if (!element || !React.isValidElement(element)) {
296
- throw new Error('Could not convert the src to a React element');
297
- }
298
- this.setState({
299
- element: element,
300
- status: STATUS.READY,
301
- });
302
- }
303
- catch (error) {
304
- this.handleError(new Error(error.message));
305
- }
306
- }
307
- });
308
- Object.defineProperty(InlineSVG.prototype, "getNode", {
309
- enumerable: false,
310
- configurable: true,
311
- writable: true,
312
- value: function () {
313
- var _a = this.props, description = _a.description, title = _a.title;
314
- try {
315
- var svgText = this.processSVG();
316
- var node = convert(svgText, { nodeOnly: true });
317
- if (!node || !(node instanceof SVGSVGElement)) {
318
- throw new Error('Could not convert the src to a DOM Node');
319
- }
320
- var svg = this.updateSVGAttributes(node);
321
- if (description) {
322
- var originalDesc = svg.querySelector('desc');
323
- if (originalDesc && originalDesc.parentNode) {
324
- originalDesc.parentNode.removeChild(originalDesc);
325
- }
326
- var descElement = document.createElementNS('http://www.w3.org/2000/svg', 'desc');
327
- descElement.innerHTML = description;
328
- svg.prepend(descElement);
329
- }
330
- if (typeof title !== 'undefined') {
331
- var originalTitle = svg.querySelector('title');
332
- if (originalTitle && originalTitle.parentNode) {
333
- originalTitle.parentNode.removeChild(originalTitle);
334
- }
335
- if (title) {
336
- var titleElement = document.createElementNS('http://www.w3.org/2000/svg', 'title');
337
- titleElement.innerHTML = title;
338
- svg.prepend(titleElement);
339
- }
340
- }
341
- return svg;
342
- }
343
- catch (error) {
344
- return this.handleError(error);
345
- }
346
- }
347
- });
348
- Object.defineProperty(InlineSVG.prototype, "load", {
349
- enumerable: false,
350
- configurable: true,
351
- writable: true,
352
- value: function () {
353
- var _this = this;
354
- /* istanbul ignore else */
355
- if (this.isActive) {
356
- this.setState({
357
- content: '',
358
- element: null,
359
- hasCache: false,
360
- status: STATUS.LOADING,
361
- }, function () {
362
- var _a = _this.props, cacheRequests = _a.cacheRequests, src = _a.src;
363
- var cache = cacheRequests && cacheStore[src];
364
- if (cache && cache.status === STATUS.LOADED) {
365
- _this.handleLoad(cache.content, true);
366
- return;
367
- }
368
- var dataURI = src.match(/^data:image\/svg[^,]*?(;base64)?,(.*)/u);
369
- var inlineSrc;
370
- if (dataURI) {
371
- inlineSrc = dataURI[1] ? window.atob(dataURI[2]) : decodeURIComponent(dataURI[2]);
372
- }
373
- else if (src.includes('<svg')) {
374
- inlineSrc = src;
375
- }
376
- if (inlineSrc) {
377
- _this.handleLoad(inlineSrc);
378
- return;
379
- }
380
- _this.request();
381
- });
382
- }
383
- }
384
- });
385
- Object.defineProperty(InlineSVG.prototype, "processSVG", {
386
- enumerable: false,
387
- configurable: true,
388
- writable: true,
389
- value: function () {
390
- var content = this.state.content;
391
- var preProcessor = this.props.preProcessor;
392
- if (preProcessor) {
393
- return preProcessor(content);
394
- }
395
- return content;
396
- }
397
- });
398
- Object.defineProperty(InlineSVG.prototype, "updateSVGAttributes", {
399
- enumerable: false,
400
- configurable: true,
401
- writable: true,
402
- value: function (node) {
403
- var _this = this;
404
- var _a = this.props, _b = _a.baseURL, baseURL = _b === void 0 ? '' : _b, uniquifyIDs = _a.uniquifyIDs;
405
- var replaceableAttributes = ['id', 'href', 'xlink:href', 'xlink:role', 'xlink:arcrole'];
406
- var linkAttributes = ['href', 'xlink:href'];
407
- var isDataValue = function (name, value) {
408
- return linkAttributes.includes(name) && (value ? !value.includes('#') : false);
409
- };
410
- if (!uniquifyIDs) {
411
- return node;
412
- }
413
- __spreadArray([], __read(node.children), false).forEach(function (d) {
414
- if (d.attributes && d.attributes.length) {
415
- var attributes_1 = Object.values(d.attributes).map(function (a) {
416
- var attribute = a;
417
- var match = a.value.match(/url\((.*?)\)/);
418
- if (match && match[1]) {
419
- attribute.value = a.value.replace(match[0], "url(".concat(baseURL).concat(match[1], "__").concat(_this.hash, ")"));
420
- }
421
- return attribute;
422
- });
423
- replaceableAttributes.forEach(function (r) {
424
- var attribute = attributes_1.find(function (a) { return a.name === r; });
425
- if (attribute && !isDataValue(r, attribute.value)) {
426
- attribute.value = "".concat(attribute.value, "__").concat(_this.hash);
427
- }
428
- });
429
- }
430
- if (d.children.length) {
431
- return _this.updateSVGAttributes(d);
432
- }
433
- return d;
434
- });
435
- return node;
436
- }
437
- });
438
- Object.defineProperty(InlineSVG.prototype, "render", {
439
- enumerable: false,
440
- configurable: true,
441
- writable: true,
442
- value: function () {
443
- var _a = this.state, element = _a.element, status = _a.status;
444
- var _b = this.props, _c = _b.children, children = _c === void 0 ? null : _c, innerRef = _b.innerRef, _d = _b.loader, loader = _d === void 0 ? null : _d;
445
- var elementProps = omit(this.props, 'baseURL', 'cacheRequests', 'children', 'description', 'fetchOptions', 'innerRef', 'loader', 'onError', 'onLoad', 'preProcessor', 'src', 'title', 'uniqueHash', 'uniquifyIDs');
446
- if (!canUseDOM()) {
447
- return loader;
448
- }
449
- if (element) {
450
- return React.cloneElement(element, __assign({ ref: innerRef }, elementProps));
451
- }
452
- if ([STATUS.UNSUPPORTED, STATUS.FAILED].includes(status)) {
453
- return children;
454
- }
455
- return loader;
456
- }
457
- });
458
- Object.defineProperty(InlineSVG, "defaultProps", {
459
- enumerable: true,
460
- configurable: true,
461
- writable: true,
462
- value: {
463
- cacheRequests: true,
464
- uniquifyIDs: false,
465
- }
466
- });
467
- return InlineSVG;
468
- }(React.PureComponent));
469
- export default InlineSVG;
470
- export * from './types';
471
- //# sourceMappingURL=index.js.map
package/esm/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,OAAO,MAAM,gBAAgB,CAAC;AAErC,OAAO,EAAE,SAAS,EAAE,sBAAsB,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAG1F,MAAM,CAAC,IAAM,UAAU,GAAmC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAE9E;IAAuC,6BAAiC;IAUtE,mBAAY,KAAY;QAAxB,YACE,kBAAM,KAAK,CAAC,SAUb;QApBgB;;;;;WAAa;QACtB;;;;mBAAW,KAAK;WAAC;QACjB;;;;mBAAgB,KAAK;WAAC;QAmJtB;;;;mBAAc,UAAC,KAAyB;gBACtC,IAAA,OAAO,GAAK,KAAI,CAAC,KAAK,QAAf,CAAgB;gBAC/B,IAAM,MAAM,GACV,KAAK,CAAC,OAAO,KAAK,8BAA8B,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC;gBAExF,0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EAAE,QAAQ,IAAK,YAAY,EAAG,CAAC;aAC9F;YAED,IAAK,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,MAAM,CAAc,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;gBACtE,OAAO,QAAQ,CAAC;aACjB;YAED,OAAO,MAAM,CAAC;QAChB,CAAC;;IA3Wa;;;;eAAe;YAC3B,aAAa,EAAE,IAAI;YACnB,WAAW,EAAE,KAAK;SACnB;MAHyB,CAGxB;IAyWJ,gBAAC;CAAA,AAjXD,CAAuC,KAAK,CAAC,aAAa,GAiXzD;eAjXoB,SAAS;AAmX9B,cAAc,SAAS,CAAC"}
package/esm/types.d.ts DELETED
@@ -1,39 +0,0 @@
1
- import * as React from 'react';
2
- import { STATUS } from './helpers';
3
- export type ErrorCallback = (error: Error | FetchError) => void;
4
- export type LoadCallback = (src: string, isCached: boolean) => void;
5
- export type PlainObject<T = unknown> = Record<string, T>;
6
- export type PreProcessorCallback = (code: string) => string;
7
- export interface Props extends Omit<React.SVGProps<SVGElement>, 'onLoad' | 'onError' | 'ref'> {
8
- baseURL?: string;
9
- cacheRequests?: boolean;
10
- children?: React.ReactNode;
11
- description?: string;
12
- fetchOptions?: RequestInit;
13
- innerRef?: React.Ref<SVGElement>;
14
- loader?: React.ReactNode;
15
- onError?: ErrorCallback;
16
- onLoad?: LoadCallback;
17
- preProcessor?: PreProcessorCallback;
18
- src: string;
19
- title?: string | null;
20
- uniqueHash?: string;
21
- uniquifyIDs?: boolean;
22
- }
23
- export interface State {
24
- content: string;
25
- element: React.ReactNode;
26
- hasCache: boolean;
27
- status: Status;
28
- }
29
- export interface FetchError extends Error {
30
- code: string;
31
- errno: string;
32
- message: string;
33
- type: string;
34
- }
35
- export type Status = (typeof STATUS)[keyof typeof STATUS];
36
- export interface StorageItem {
37
- content: string;
38
- status: Status;
39
- }
package/esm/types.js DELETED
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=types.js.map
package/esm/types.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
package/lib/helpers.d.ts DELETED
@@ -1,17 +0,0 @@
1
- import type { PlainObject } from './types';
2
- export declare const STATUS: {
3
- readonly IDLE: "idle";
4
- readonly LOADING: "loading";
5
- readonly LOADED: "loaded";
6
- readonly FAILED: "failed";
7
- readonly READY: "ready";
8
- readonly UNSUPPORTED: "unsupported";
9
- };
10
- export declare function canUseDOM(): boolean;
11
- export declare function isSupportedEnvironment(): boolean;
12
- export declare function supportsInlineSVG(): boolean;
13
- export declare function randomString(length: number): string;
14
- /**
15
- * Remove properties from an object
16
- */
17
- export declare function omit<T extends PlainObject, K extends keyof T>(input: T, ...filter: K[]): Omit<T, K>;