@wix/wix-ui-icons-common 3.190.0 → 3.190.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/dist/cjs/core/fetcher.js +10 -16
- package/dist/cjs/core/sanitize.js +48 -0
- package/dist/esm/core/fetcher.js +9 -14
- package/dist/esm/core/sanitize.js +14 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/core/fetcher.d.ts +0 -1
- package/dist/types/core/fetcher.d.ts.map +1 -1
- package/dist/types/core/sanitize.d.ts +2 -0
- package/dist/types/core/sanitize.d.ts.map +1 -0
- package/package.json +2 -2
package/dist/cjs/core/fetcher.js
CHANGED
|
@@ -30,22 +30,17 @@ var fetcher_exports = {};
|
|
|
30
30
|
__export(fetcher_exports, {
|
|
31
31
|
IconContentFetcher: () => IconContentFetcher,
|
|
32
32
|
createTimeoutSignal: () => createTimeoutSignal,
|
|
33
|
-
iconContentFetcher: () => iconContentFetcher
|
|
34
|
-
sanitizeSvgContent: () => sanitizeSvgContent
|
|
33
|
+
iconContentFetcher: () => iconContentFetcher
|
|
35
34
|
});
|
|
36
35
|
module.exports = __toCommonJS(fetcher_exports);
|
|
37
|
-
var import_dompurify = __toESM(require("dompurify"));
|
|
38
36
|
const ABORT_SIGNAL_TIMEOUT = 5e3;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
NAMESPACE: SVG_NAMESPACE
|
|
47
|
-
});
|
|
48
|
-
}
|
|
37
|
+
let sanitizer;
|
|
38
|
+
const loadSanitizer = () => sanitizer ??= Promise.resolve().then(() => __toESM(require("./sanitize"))).catch((error) => {
|
|
39
|
+
sanitizer = void 0;
|
|
40
|
+
throw error;
|
|
41
|
+
});
|
|
42
|
+
loadSanitizer().catch(() => {
|
|
43
|
+
});
|
|
49
44
|
const isTransientError = (error) => error instanceof Error && (error.name === "TimeoutError" || error.name === "AbortError");
|
|
50
45
|
function createTimeoutSignal(timeout) {
|
|
51
46
|
if (typeof AbortSignal.timeout === "function") {
|
|
@@ -104,7 +99,7 @@ class IconContentFetcher {
|
|
|
104
99
|
throw error;
|
|
105
100
|
}
|
|
106
101
|
};
|
|
107
|
-
const request = fetchContent(2).then((data) => {
|
|
102
|
+
const request = Promise.all([fetchContent(2), loadSanitizer()]).then(([data, { sanitizeSvgContent }]) => {
|
|
108
103
|
this.cache.set(cacheKey, sanitizeSvgContent(data.content));
|
|
109
104
|
this.pendingRequests.delete(cacheKey);
|
|
110
105
|
}).catch((error) => {
|
|
@@ -124,6 +119,5 @@ const iconContentFetcher = new IconContentFetcher();
|
|
|
124
119
|
0 && (module.exports = {
|
|
125
120
|
IconContentFetcher,
|
|
126
121
|
createTimeoutSignal,
|
|
127
|
-
iconContentFetcher
|
|
128
|
-
sanitizeSvgContent
|
|
122
|
+
iconContentFetcher
|
|
129
123
|
});
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var sanitize_exports = {};
|
|
30
|
+
__export(sanitize_exports, {
|
|
31
|
+
sanitizeSvgContent: () => sanitizeSvgContent
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(sanitize_exports);
|
|
34
|
+
var import_dompurify = __toESM(require("dompurify"));
|
|
35
|
+
const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
|
|
36
|
+
function sanitizeSvgContent(content) {
|
|
37
|
+
if (typeof content !== "string" || !import_dompurify.default.isSupported) {
|
|
38
|
+
return "";
|
|
39
|
+
}
|
|
40
|
+
return import_dompurify.default.sanitize(content, {
|
|
41
|
+
USE_PROFILES: { svg: true, svgFilters: true },
|
|
42
|
+
NAMESPACE: SVG_NAMESPACE
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
46
|
+
0 && (module.exports = {
|
|
47
|
+
sanitizeSvgContent
|
|
48
|
+
});
|
package/dist/esm/core/fetcher.js
CHANGED
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
import DOMPurify from "dompurify";
|
|
2
1
|
const ABORT_SIGNAL_TIMEOUT = 5e3;
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
NAMESPACE: SVG_NAMESPACE
|
|
11
|
-
});
|
|
12
|
-
}
|
|
2
|
+
let sanitizer;
|
|
3
|
+
const loadSanitizer = () => sanitizer ?? (sanitizer = import("./sanitize.js").catch((error) => {
|
|
4
|
+
sanitizer = void 0;
|
|
5
|
+
throw error;
|
|
6
|
+
}));
|
|
7
|
+
loadSanitizer().catch(() => {
|
|
8
|
+
});
|
|
13
9
|
const isTransientError = (error) => error instanceof Error && (error.name === "TimeoutError" || error.name === "AbortError");
|
|
14
10
|
function createTimeoutSignal(timeout) {
|
|
15
11
|
if (typeof AbortSignal.timeout === "function") {
|
|
@@ -68,7 +64,7 @@ class IconContentFetcher {
|
|
|
68
64
|
throw error;
|
|
69
65
|
}
|
|
70
66
|
};
|
|
71
|
-
const request = fetchContent(2).then((data) => {
|
|
67
|
+
const request = Promise.all([fetchContent(2), loadSanitizer()]).then(([data, { sanitizeSvgContent }]) => {
|
|
72
68
|
this.cache.set(cacheKey, sanitizeSvgContent(data.content));
|
|
73
69
|
this.pendingRequests.delete(cacheKey);
|
|
74
70
|
}).catch((error) => {
|
|
@@ -87,6 +83,5 @@ const iconContentFetcher = new IconContentFetcher();
|
|
|
87
83
|
export {
|
|
88
84
|
IconContentFetcher,
|
|
89
85
|
createTimeoutSignal,
|
|
90
|
-
iconContentFetcher
|
|
91
|
-
sanitizeSvgContent
|
|
86
|
+
iconContentFetcher
|
|
92
87
|
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import DOMPurify from "dompurify";
|
|
2
|
+
const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
|
|
3
|
+
function sanitizeSvgContent(content) {
|
|
4
|
+
if (typeof content !== "string" || !DOMPurify.isSupported) {
|
|
5
|
+
return "";
|
|
6
|
+
}
|
|
7
|
+
return DOMPurify.sanitize(content, {
|
|
8
|
+
USE_PROFILES: { svg: true, svgFilters: true },
|
|
9
|
+
NAMESPACE: SVG_NAMESPACE
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
export {
|
|
13
|
+
sanitizeSvgContent
|
|
14
|
+
};
|