react-inlinesvg 4.0.6 → 4.1.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/dist/index.d.mts +6 -3
- package/dist/index.d.ts +6 -3
- package/dist/index.js +263 -228
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +271 -228
- package/dist/index.mjs.map +1 -1
- package/dist/provider.js +2 -1
- package/dist/provider.js.map +1 -1
- package/dist/provider.mjs +3 -1
- package/dist/provider.mjs.map +1 -1
- package/package.json +12 -12
- package/src/index.tsx +195 -270
- package/src/{cache.ts → modules/cache.ts} +3 -2
- package/src/{helpers.ts → modules/helpers.ts} +1 -1
- package/src/modules/hooks.tsx +11 -0
- package/src/modules/utils.ts +122 -0
- package/src/provider.tsx +1 -1
- package/src/types.ts +20 -16
package/src/provider.tsx
CHANGED
package/src/types.ts
CHANGED
|
@@ -7,22 +7,24 @@ export type LoadCallback = (src: string, isCached: boolean) => void;
|
|
|
7
7
|
export type PlainObject<T = unknown> = Record<string, T>;
|
|
8
8
|
export type PreProcessorCallback = (code: string) => string;
|
|
9
9
|
|
|
10
|
-
export
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
10
|
+
export type Props = Simplify<
|
|
11
|
+
Omit<React.SVGProps<SVGElement>, 'onLoad' | 'onError' | 'ref'> & {
|
|
12
|
+
baseURL?: string;
|
|
13
|
+
cacheRequests?: boolean;
|
|
14
|
+
children?: React.ReactNode;
|
|
15
|
+
description?: string;
|
|
16
|
+
fetchOptions?: RequestInit;
|
|
17
|
+
innerRef?: React.Ref<SVGElement>;
|
|
18
|
+
loader?: React.ReactNode;
|
|
19
|
+
onError?: ErrorCallback;
|
|
20
|
+
onLoad?: LoadCallback;
|
|
21
|
+
preProcessor?: PreProcessorCallback;
|
|
22
|
+
src: string;
|
|
23
|
+
title?: string | null;
|
|
24
|
+
uniqueHash?: string;
|
|
25
|
+
uniquifyIDs?: boolean;
|
|
26
|
+
}
|
|
27
|
+
>;
|
|
26
28
|
|
|
27
29
|
export interface State {
|
|
28
30
|
content: string;
|
|
@@ -38,6 +40,8 @@ export interface FetchError extends Error {
|
|
|
38
40
|
type: string;
|
|
39
41
|
}
|
|
40
42
|
|
|
43
|
+
export type Simplify<T> = { [KeyType in keyof T]: T[KeyType] } & {};
|
|
44
|
+
|
|
41
45
|
export type Status = (typeof STATUS)[keyof typeof STATUS];
|
|
42
46
|
|
|
43
47
|
export interface StorageItem {
|