@symbo.ls/scratch 3.8.7 → 3.8.9
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/system/svg.js +21 -12
- package/dist/esm/system/svg.js +21 -12
- package/dist/iife/index.js +21 -12
- package/package.json +3 -3
- package/src/system/svg.js +22 -13
package/dist/cjs/system/svg.js
CHANGED
|
@@ -44,7 +44,7 @@ const setSVG = (val, key) => {
|
|
|
44
44
|
const appendSVGSprite = (LIBRARY, options = DEF_OPTIONS) => {
|
|
45
45
|
const CONFIG = (0, import_factory.getActiveConfig)();
|
|
46
46
|
const lib = Object.keys(LIBRARY).length ? {} : CONFIG.svg;
|
|
47
|
-
for (const key in LIBRARY) lib[key] =
|
|
47
|
+
for (const key in LIBRARY) lib[key] = LIBRARY[key];
|
|
48
48
|
appendSVG(lib, options);
|
|
49
49
|
};
|
|
50
50
|
const setSvgIcon = (val, key) => {
|
|
@@ -57,12 +57,12 @@ const setSvgIcon = (val, key) => {
|
|
|
57
57
|
const appendSvgIconsSprite = (LIBRARY, options = DEF_OPTIONS) => {
|
|
58
58
|
const CONFIG = (0, import_factory.getActiveConfig)();
|
|
59
59
|
const lib = Object.keys(LIBRARY).length ? {} : CONFIG.icons;
|
|
60
|
-
for (const key in LIBRARY) lib[key] =
|
|
60
|
+
for (const key in LIBRARY) lib[key] = LIBRARY[key];
|
|
61
61
|
appendSVG(lib, options);
|
|
62
62
|
};
|
|
63
|
-
const createSVGSpriteElement = (options = { isRoot: true }) => {
|
|
64
|
-
if (!
|
|
65
|
-
const svgElem =
|
|
63
|
+
const createSVGSpriteElement = (doc, options = { isRoot: true }) => {
|
|
64
|
+
if (!doc || !doc.createElementNS) return;
|
|
65
|
+
const svgElem = doc.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
66
66
|
if (options.isRoot) {
|
|
67
67
|
svgElem.setAttribute("aria-hidden", "true");
|
|
68
68
|
svgElem.setAttribute("width", "0");
|
|
@@ -83,15 +83,24 @@ const appendSVG = (lib, options = DEF_OPTIONS) => {
|
|
|
83
83
|
}
|
|
84
84
|
const exists = doc.querySelector("#svgSprite");
|
|
85
85
|
const SVGsprite = (0, import_utils2.generateSprite)(lib);
|
|
86
|
+
const spriteHtml = `<svg aria-hidden="true" width="0" height="0" style="position:absolute" id="svgSprite">${SVGsprite}</svg>`;
|
|
86
87
|
if (exists) {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
88
|
+
if (doc.body.insertAdjacentHTML) {
|
|
89
|
+
exists.insertAdjacentHTML("beforeend", SVGsprite);
|
|
90
|
+
} else {
|
|
91
|
+
const tempSVG = createSVGSpriteElement(doc, { isRoot: false });
|
|
92
|
+
tempSVG.innerHTML = SVGsprite;
|
|
93
|
+
exists.append(...tempSVG.children);
|
|
94
|
+
}
|
|
90
95
|
} else {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
doc
|
|
96
|
+
if (doc.body.insertAdjacentHTML) {
|
|
97
|
+
doc.body.insertAdjacentHTML("afterbegin", spriteHtml);
|
|
98
|
+
} else {
|
|
99
|
+
const svgSpriteDOM = createSVGSpriteElement(doc);
|
|
100
|
+
if (svgSpriteDOM && svgSpriteDOM.nodeType) {
|
|
101
|
+
svgSpriteDOM.innerHTML = SVGsprite;
|
|
102
|
+
doc.body.prepend(svgSpriteDOM);
|
|
103
|
+
}
|
|
95
104
|
}
|
|
96
105
|
}
|
|
97
106
|
};
|
package/dist/esm/system/svg.js
CHANGED
|
@@ -18,7 +18,7 @@ const setSVG = (val, key) => {
|
|
|
18
18
|
const appendSVGSprite = (LIBRARY, options = DEF_OPTIONS) => {
|
|
19
19
|
const CONFIG = getActiveConfig();
|
|
20
20
|
const lib = Object.keys(LIBRARY).length ? {} : CONFIG.svg;
|
|
21
|
-
for (const key in LIBRARY) lib[key] =
|
|
21
|
+
for (const key in LIBRARY) lib[key] = LIBRARY[key];
|
|
22
22
|
appendSVG(lib, options);
|
|
23
23
|
};
|
|
24
24
|
const setSvgIcon = (val, key) => {
|
|
@@ -31,12 +31,12 @@ const setSvgIcon = (val, key) => {
|
|
|
31
31
|
const appendSvgIconsSprite = (LIBRARY, options = DEF_OPTIONS) => {
|
|
32
32
|
const CONFIG = getActiveConfig();
|
|
33
33
|
const lib = Object.keys(LIBRARY).length ? {} : CONFIG.icons;
|
|
34
|
-
for (const key in LIBRARY) lib[key] =
|
|
34
|
+
for (const key in LIBRARY) lib[key] = LIBRARY[key];
|
|
35
35
|
appendSVG(lib, options);
|
|
36
36
|
};
|
|
37
|
-
const createSVGSpriteElement = (options = { isRoot: true }) => {
|
|
38
|
-
if (!
|
|
39
|
-
const svgElem =
|
|
37
|
+
const createSVGSpriteElement = (doc, options = { isRoot: true }) => {
|
|
38
|
+
if (!doc || !doc.createElementNS) return;
|
|
39
|
+
const svgElem = doc.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
40
40
|
if (options.isRoot) {
|
|
41
41
|
svgElem.setAttribute("aria-hidden", "true");
|
|
42
42
|
svgElem.setAttribute("width", "0");
|
|
@@ -57,15 +57,24 @@ const appendSVG = (lib, options = DEF_OPTIONS) => {
|
|
|
57
57
|
}
|
|
58
58
|
const exists = doc.querySelector("#svgSprite");
|
|
59
59
|
const SVGsprite = generateSprite(lib);
|
|
60
|
+
const spriteHtml = `<svg aria-hidden="true" width="0" height="0" style="position:absolute" id="svgSprite">${SVGsprite}</svg>`;
|
|
60
61
|
if (exists) {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
if (doc.body.insertAdjacentHTML) {
|
|
63
|
+
exists.insertAdjacentHTML("beforeend", SVGsprite);
|
|
64
|
+
} else {
|
|
65
|
+
const tempSVG = createSVGSpriteElement(doc, { isRoot: false });
|
|
66
|
+
tempSVG.innerHTML = SVGsprite;
|
|
67
|
+
exists.append(...tempSVG.children);
|
|
68
|
+
}
|
|
64
69
|
} else {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
doc
|
|
70
|
+
if (doc.body.insertAdjacentHTML) {
|
|
71
|
+
doc.body.insertAdjacentHTML("afterbegin", spriteHtml);
|
|
72
|
+
} else {
|
|
73
|
+
const svgSpriteDOM = createSVGSpriteElement(doc);
|
|
74
|
+
if (svgSpriteDOM && svgSpriteDOM.nodeType) {
|
|
75
|
+
svgSpriteDOM.innerHTML = SVGsprite;
|
|
76
|
+
doc.body.prepend(svgSpriteDOM);
|
|
77
|
+
}
|
|
69
78
|
}
|
|
70
79
|
}
|
|
71
80
|
};
|
package/dist/iife/index.js
CHANGED
|
@@ -2694,7 +2694,7 @@ var SmblsScratch = (() => {
|
|
|
2694
2694
|
var appendSVGSprite = (LIBRARY, options = DEF_OPTIONS) => {
|
|
2695
2695
|
const CONFIG2 = getActiveConfig();
|
|
2696
2696
|
const lib = Object.keys(LIBRARY).length ? {} : CONFIG2.svg;
|
|
2697
|
-
for (const key in LIBRARY) lib[key] =
|
|
2697
|
+
for (const key in LIBRARY) lib[key] = LIBRARY[key];
|
|
2698
2698
|
appendSVG(lib, options);
|
|
2699
2699
|
};
|
|
2700
2700
|
var setSvgIcon = (val, key) => {
|
|
@@ -2707,12 +2707,12 @@ var SmblsScratch = (() => {
|
|
|
2707
2707
|
var appendSvgIconsSprite = (LIBRARY, options = DEF_OPTIONS) => {
|
|
2708
2708
|
const CONFIG2 = getActiveConfig();
|
|
2709
2709
|
const lib = Object.keys(LIBRARY).length ? {} : CONFIG2.icons;
|
|
2710
|
-
for (const key in LIBRARY) lib[key] =
|
|
2710
|
+
for (const key in LIBRARY) lib[key] = LIBRARY[key];
|
|
2711
2711
|
appendSVG(lib, options);
|
|
2712
2712
|
};
|
|
2713
|
-
var createSVGSpriteElement = (options = { isRoot: true }) => {
|
|
2714
|
-
if (!
|
|
2715
|
-
const svgElem =
|
|
2713
|
+
var createSVGSpriteElement = (doc, options = { isRoot: true }) => {
|
|
2714
|
+
if (!doc || !doc.createElementNS) return;
|
|
2715
|
+
const svgElem = doc.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
2716
2716
|
if (options.isRoot) {
|
|
2717
2717
|
svgElem.setAttribute("aria-hidden", "true");
|
|
2718
2718
|
svgElem.setAttribute("width", "0");
|
|
@@ -2733,15 +2733,24 @@ var SmblsScratch = (() => {
|
|
|
2733
2733
|
}
|
|
2734
2734
|
const exists = doc.querySelector("#svgSprite");
|
|
2735
2735
|
const SVGsprite = generateSprite(lib);
|
|
2736
|
+
const spriteHtml = `<svg aria-hidden="true" width="0" height="0" style="position:absolute" id="svgSprite">${SVGsprite}</svg>`;
|
|
2736
2737
|
if (exists) {
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2738
|
+
if (doc.body.insertAdjacentHTML) {
|
|
2739
|
+
exists.insertAdjacentHTML("beforeend", SVGsprite);
|
|
2740
|
+
} else {
|
|
2741
|
+
const tempSVG = createSVGSpriteElement(doc, { isRoot: false });
|
|
2742
|
+
tempSVG.innerHTML = SVGsprite;
|
|
2743
|
+
exists.append(...tempSVG.children);
|
|
2744
|
+
}
|
|
2740
2745
|
} else {
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
doc
|
|
2746
|
+
if (doc.body.insertAdjacentHTML) {
|
|
2747
|
+
doc.body.insertAdjacentHTML("afterbegin", spriteHtml);
|
|
2748
|
+
} else {
|
|
2749
|
+
const svgSpriteDOM = createSVGSpriteElement(doc);
|
|
2750
|
+
if (svgSpriteDOM && svgSpriteDOM.nodeType) {
|
|
2751
|
+
svgSpriteDOM.innerHTML = SVGsprite;
|
|
2752
|
+
doc.body.prepend(svgSpriteDOM);
|
|
2753
|
+
}
|
|
2745
2754
|
}
|
|
2746
2755
|
}
|
|
2747
2756
|
};
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@symbo.ls/scratch",
|
|
3
3
|
"description": "Φ / CSS framework and methodology.",
|
|
4
4
|
"author": "symbo.ls",
|
|
5
|
-
"version": "3.8.
|
|
5
|
+
"version": "3.8.9",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist",
|
|
8
8
|
"*.js",
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
"prepublish": "npm run build && npm run copy:package:cjs"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@domql/utils": "^3.8.
|
|
37
|
-
"@symbo.ls/smbls-utils": "^3.8.
|
|
36
|
+
"@domql/utils": "^3.8.9",
|
|
37
|
+
"@symbo.ls/smbls-utils": "^3.8.9",
|
|
38
38
|
"color-contrast-checker": "^1.5.0"
|
|
39
39
|
},
|
|
40
40
|
"gitHead": "9fc1b79b41cdc725ca6b24aec64920a599634681",
|
package/src/system/svg.js
CHANGED
|
@@ -23,7 +23,7 @@ export const appendSVGSprite = (LIBRARY, options = DEF_OPTIONS) => {
|
|
|
23
23
|
const CONFIG = getActiveConfig()
|
|
24
24
|
|
|
25
25
|
const lib = Object.keys(LIBRARY).length ? {} : CONFIG.svg
|
|
26
|
-
for (const key in LIBRARY) lib[key] =
|
|
26
|
+
for (const key in LIBRARY) lib[key] = LIBRARY[key]
|
|
27
27
|
|
|
28
28
|
appendSVG(lib, options)
|
|
29
29
|
}
|
|
@@ -39,14 +39,14 @@ export const appendSvgIconsSprite = (LIBRARY, options = DEF_OPTIONS) => {
|
|
|
39
39
|
const CONFIG = getActiveConfig()
|
|
40
40
|
|
|
41
41
|
const lib = Object.keys(LIBRARY).length ? {} : CONFIG.icons
|
|
42
|
-
for (const key in LIBRARY) lib[key] =
|
|
42
|
+
for (const key in LIBRARY) lib[key] = LIBRARY[key]
|
|
43
43
|
|
|
44
44
|
appendSVG(lib, options)
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
const createSVGSpriteElement = (options = { isRoot: true }) => {
|
|
48
|
-
if (!
|
|
49
|
-
const svgElem =
|
|
47
|
+
const createSVGSpriteElement = (doc, options = { isRoot: true }) => {
|
|
48
|
+
if (!doc || !doc.createElementNS) return
|
|
49
|
+
const svgElem = doc.createElementNS('http://www.w3.org/2000/svg', 'svg')
|
|
50
50
|
if (options.isRoot) {
|
|
51
51
|
svgElem.setAttribute('aria-hidden', 'true')
|
|
52
52
|
svgElem.setAttribute('width', '0')
|
|
@@ -71,16 +71,25 @@ const appendSVG = (lib, options = DEF_OPTIONS) => {
|
|
|
71
71
|
const exists = doc.querySelector('#svgSprite')
|
|
72
72
|
const SVGsprite = generateSprite(lib)
|
|
73
73
|
|
|
74
|
+
const spriteHtml = `<svg aria-hidden="true" width="0" height="0" style="position:absolute" id="svgSprite">${SVGsprite}</svg>`
|
|
75
|
+
|
|
74
76
|
if (exists) {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
if (doc.body.insertAdjacentHTML) {
|
|
78
|
+
exists.insertAdjacentHTML('beforeend', SVGsprite)
|
|
79
|
+
} else {
|
|
80
|
+
const tempSVG = createSVGSpriteElement(doc, { isRoot: false })
|
|
81
|
+
tempSVG.innerHTML = SVGsprite
|
|
82
|
+
exists.append(...tempSVG.children)
|
|
83
|
+
}
|
|
79
84
|
} else {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
doc
|
|
85
|
+
if (doc.body.insertAdjacentHTML) {
|
|
86
|
+
doc.body.insertAdjacentHTML('afterbegin', spriteHtml)
|
|
87
|
+
} else {
|
|
88
|
+
const svgSpriteDOM = createSVGSpriteElement(doc)
|
|
89
|
+
if (svgSpriteDOM && svgSpriteDOM.nodeType) {
|
|
90
|
+
svgSpriteDOM.innerHTML = SVGsprite
|
|
91
|
+
doc.body.prepend(svgSpriteDOM)
|
|
92
|
+
}
|
|
84
93
|
}
|
|
85
94
|
}
|
|
86
95
|
}
|