@uxf/icons-generator 11.118.0 → 11.123.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 +194 -122
- package/package.json +23 -23
- package/src/fa-pro-types.d.ts +1 -1
- package/src/utils/_createSpriteContent.js +8 -3
|
@@ -6,8 +6,13 @@ function _createSpriteContent(config) {
|
|
|
6
6
|
let spriteTextContent = `<svg xmlns="http://www.w3.org/2000/svg">`;
|
|
7
7
|
Object.keys(config.icons).map((name) => {
|
|
8
8
|
const icon = config.icons[name];
|
|
9
|
+
// `overflow="visible"` guards against source icons (notably some FontAwesome v7
|
|
10
|
+
// glyphs) whose path extends beyond their declared width/height — the symbol
|
|
11
|
+
// viewport would otherwise clip the bleed (UA default `overflow: hidden`), and
|
|
12
|
+
// consumers can't reach it via CSS because the sprite is referenced across
|
|
13
|
+
// documents with <use>. Paired with `.uxf-icon { overflow: visible }` in @uxf/ui.
|
|
9
14
|
if (_iconTypeResolver_1._iconTypeResolver.isSimpleIcon(icon)) {
|
|
10
|
-
spriteTextContent += `<symbol id="icon-sprite--${name}" viewBox="0 0 ${icon.width} ${icon.height}">`;
|
|
15
|
+
spriteTextContent += `<symbol id="icon-sprite--${name}" viewBox="0 0 ${icon.width} ${icon.height}" overflow="visible">`;
|
|
11
16
|
spriteTextContent += icon.data;
|
|
12
17
|
spriteTextContent += `</symbol>`;
|
|
13
18
|
return;
|
|
@@ -15,13 +20,13 @@ function _createSpriteContent(config) {
|
|
|
15
20
|
if (_iconTypeResolver_1._iconTypeResolver.isSizedIcon(icon)) {
|
|
16
21
|
Object.keys(icon).map((s) => {
|
|
17
22
|
const svg = icon[Number(s)];
|
|
18
|
-
spriteTextContent += `<symbol id="icon-sprite--${name}_${s}" viewBox="0 0 ${s} ${s}">${svg}</symbol>`;
|
|
23
|
+
spriteTextContent += `<symbol id="icon-sprite--${name}_${s}" viewBox="0 0 ${s} ${s}" overflow="visible">${svg}</symbol>`;
|
|
19
24
|
});
|
|
20
25
|
return;
|
|
21
26
|
}
|
|
22
27
|
if (_iconTypeResolver_1._iconTypeResolver.isFromAdapter(icon)) {
|
|
23
28
|
const svg = icon(config);
|
|
24
|
-
spriteTextContent += `<symbol id="icon-sprite--${name}" viewBox="0 0 ${svg.width} ${svg.height}">${svg.path}</symbol>`;
|
|
29
|
+
spriteTextContent += `<symbol id="icon-sprite--${name}" viewBox="0 0 ${svg.width} ${svg.height}" overflow="visible">${svg.path}</symbol>`;
|
|
25
30
|
return;
|
|
26
31
|
}
|
|
27
32
|
throw new Error(`Unknown icon format for icon: "${name}".`);
|