@matdata/yasgui-utils 5.10.0 → 5.11.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/README.md +6 -2
- package/build/ts/src/index.d.ts +0 -7
- package/build/ts/src/index.js +0 -16
- package/build/ts/src/index.js.map +1 -1
- package/build/utils.min.js +3 -3
- package/build/utils.min.js.map +3 -3
- package/package.json +1 -1
- package/src/index.ts +0 -30
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -3,36 +3,6 @@ export { default as Storage } from "./Storage";
|
|
|
3
3
|
|
|
4
4
|
const { sanitize } = DOMPurify;
|
|
5
5
|
|
|
6
|
-
export function drawSvgStringAsElement(svgString: string) {
|
|
7
|
-
if (svgString && svgString.trim().indexOf("<svg") == 0) {
|
|
8
|
-
//no style passed via config. guess own styles
|
|
9
|
-
var parser = new DOMParser();
|
|
10
|
-
var dom = parser.parseFromString(svgString, "text/xml");
|
|
11
|
-
var svg = dom.documentElement;
|
|
12
|
-
svg.setAttribute("aria-hidden", "true");
|
|
13
|
-
|
|
14
|
-
var svgContainer = document.createElement("div");
|
|
15
|
-
svgContainer.className = "svgImg";
|
|
16
|
-
svgContainer.appendChild(svg);
|
|
17
|
-
return svgContainer;
|
|
18
|
-
}
|
|
19
|
-
throw new Error("No svg string given. Cannot draw");
|
|
20
|
-
}
|
|
21
|
-
export interface FaIcon {
|
|
22
|
-
width: number;
|
|
23
|
-
height: number;
|
|
24
|
-
svgPathData: string;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Draws font fontawesome icon as svg. This is a lot more lightweight then the option that is offered by fontawesome
|
|
29
|
-
* @param faIcon
|
|
30
|
-
* @returns
|
|
31
|
-
*/
|
|
32
|
-
export function drawFontAwesomeIconAsSvg(faIcon: FaIcon) {
|
|
33
|
-
return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${faIcon.width} ${faIcon.height}" aria-hidden="true"><path fill="currentColor" d="${faIcon.svgPathData}"></path></svg>`;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
6
|
export function hasClass(el: Element | undefined, className: string) {
|
|
37
7
|
if (!el) return;
|
|
38
8
|
if (el.classList) return el.classList.contains(className);
|