@stacksjs/iconify-core 0.2.198 → 0.2.200
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.js +5 -51
- package/dist/index.js.map +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,62 +1,16 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const {
|
|
5
|
-
size,
|
|
6
|
-
width: propWidth,
|
|
7
|
-
height: propHeight,
|
|
8
|
-
color = "currentColor",
|
|
9
|
-
hFlip = false,
|
|
10
|
-
vFlip = false,
|
|
11
|
-
rotate = 0,
|
|
12
|
-
class: className = "",
|
|
13
|
-
style: customStyle = ""
|
|
14
|
-
} = props;
|
|
15
|
-
const width = propWidth || size || iconData.width || 24;
|
|
16
|
-
const height = propHeight || size || iconData.height || 24;
|
|
17
|
-
const viewBox = iconData.viewBox || `0 0 ${iconData.width || 24} ${iconData.height || 24}`;
|
|
18
|
-
const transforms = [];
|
|
19
|
-
if (hFlip)
|
|
20
|
-
transforms.push("scaleX(-1)");
|
|
21
|
-
if (vFlip)
|
|
22
|
-
transforms.push("scaleY(-1)");
|
|
23
|
-
if (rotate) {
|
|
24
|
-
const deg = typeof rotate === "number" && rotate < 4 ? rotate * 90 : rotate;
|
|
25
|
-
transforms.push(`rotate(${deg}deg)`);
|
|
26
|
-
}
|
|
27
|
-
const transform = transforms.length > 0 ? transforms.join(" ") : "";
|
|
28
|
-
const transformStyle = transform ? `transform: ${transform};` : "";
|
|
29
|
-
const styles = [];
|
|
30
|
-
if (transformStyle)
|
|
31
|
-
styles.push(transformStyle);
|
|
32
|
-
if (customStyle)
|
|
33
|
-
styles.push(customStyle);
|
|
34
|
-
const style = styles.length > 0 ? ` style="${styles.join(" ")}"` : "";
|
|
35
|
-
const classAttr = className ? ` class="${className}"` : "";
|
|
36
|
-
let body = iconData.body;
|
|
37
|
-
if (color && color !== "currentColor") {
|
|
38
|
-
body = body.replace(/currentColor/g, color);
|
|
39
|
-
}
|
|
40
|
-
return `<svg xmlns="http://www.w3.org/2000/svg" width="${width}" height="${height}" viewBox="${viewBox}"${classAttr}${style}>${body}</svg>`;
|
|
41
|
-
}
|
|
42
|
-
function generateIconCSS(prefix) {
|
|
43
|
-
return `
|
|
44
|
-
.icon-${prefix} {
|
|
2
|
+
function B(j,Q={}){let{size:K,width:R,height:T,color:I="currentColor",hFlip:U=!1,vFlip:V=!1,rotate:k=0,class:L="",style:M=""}=Q,X=R||K||j.width||24,Y=T||K||j.height||24,Z=j.viewBox||`0 0 ${j.width||24} ${j.height||24}`,q=[];if(U)q.push("scaleX(-1)");if(V)q.push("scaleY(-1)");if(k){let A=typeof k==="number"&&k<4?k*90:k;q.push(`rotate(${A}deg)`)}let O=q.length>0?q.join(" "):"",P=O?`transform: ${O};`:"",E=[];if(P)E.push(P);if(M)E.push(M);let _=E.length>0?` style="${E.join(" ")}"`:"",$=L?` class="${L}"`:"",J=j.body;if(I&&I!=="currentColor")J=J.replace(/currentColor/g,I);return`<svg xmlns="http://www.w3.org/2000/svg" width="${X}" height="${Y}" viewBox="${Z}"${$}${_}>${J}</svg>`}function C(j){return`
|
|
3
|
+
.icon-${j} {
|
|
45
4
|
display: inline-block;
|
|
46
5
|
width: 1em;
|
|
47
6
|
height: 1em;
|
|
48
7
|
vertical-align: -0.125em;
|
|
49
8
|
}
|
|
50
9
|
|
|
51
|
-
.icon-${
|
|
10
|
+
.icon-${j} svg {
|
|
52
11
|
width: 100%;
|
|
53
12
|
height: 100%;
|
|
54
13
|
}
|
|
55
|
-
`.trim();
|
|
56
|
-
}
|
|
57
|
-
export {
|
|
58
|
-
renderIcon,
|
|
59
|
-
generateIconCSS
|
|
60
|
-
};
|
|
14
|
+
`.trim()}export{B as renderIcon,C as generateIconCSS};
|
|
61
15
|
|
|
62
|
-
//# debugId=
|
|
16
|
+
//# debugId=C1064E8941B4487D64756E2164756E21
|
package/dist/index.js.map
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"sourcesContent": [
|
|
5
5
|
"export interface IconProps {\n /**\n * Icon name\n */\n name?: string\n /**\n * Icon size (width and height)\n * @default \"1em\"\n */\n size?: string | number\n /**\n * Icon width\n */\n width?: string | number\n /**\n * Icon height\n */\n height?: string | number\n /**\n * Icon color\n * @default \"currentColor\"\n */\n color?: string\n /**\n * Horizontal flip\n */\n hFlip?: boolean\n /**\n * Vertical flip\n */\n vFlip?: boolean\n /**\n * Rotation in degrees\n */\n rotate?: 0 | 90 | 180 | 270 | 1 | 2 | 3\n /**\n * Additional CSS classes\n */\n class?: string\n /**\n * Additional inline styles\n */\n style?: string\n}\n\nexport interface IconData {\n /**\n * Icon body (SVG path data)\n */\n body: string\n /**\n * Icon width (default: 24)\n */\n width?: number\n /**\n * Icon height (default: 24)\n */\n height?: number\n /**\n * Icon viewBox\n */\n viewBox?: string\n /**\n * Whether the icon uses currentColor\n */\n currentColor?: boolean\n}\n\n/**\n * Generate SVG string from icon data\n */\nexport function renderIcon(iconData: IconData, props: IconProps = {}): string {\n const {\n size,\n width: propWidth,\n height: propHeight,\n color = 'currentColor',\n hFlip = false,\n vFlip = false,\n rotate = 0,\n class: className = '',\n style: customStyle = '',\n } = props\n\n const width = propWidth || size || iconData.width || 24\n const height = propHeight || size || iconData.height || 24\n const viewBox = iconData.viewBox || `0 0 ${iconData.width || 24} ${iconData.height || 24}`\n\n // Build transform\n const transforms: string[] = []\n if (hFlip)\n transforms.push('scaleX(-1)')\n if (vFlip)\n transforms.push('scaleY(-1)')\n if (rotate) {\n const deg = typeof rotate === 'number' && rotate < 4 ? rotate * 90 : rotate\n transforms.push(`rotate(${deg}deg)`)\n }\n\n const transform = transforms.length > 0 ? transforms.join(' ') : ''\n const transformStyle = transform ? `transform: ${transform};` : ''\n\n // Build style\n const styles: string[] = []\n if (transformStyle)\n styles.push(transformStyle)\n if (customStyle)\n styles.push(customStyle)\n\n const style = styles.length > 0 ? ` style=\"${styles.join(' ')}\"` : ''\n const classAttr = className ? ` class=\"${className}\"` : ''\n\n // Replace currentColor in body if color is specified\n let body = iconData.body\n if (color && color !== 'currentColor') {\n body = body.replace(/currentColor/g, color)\n }\n\n return `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"${width}\" height=\"${height}\" viewBox=\"${viewBox}\"${classAttr}${style}>${body}</svg>`\n}\n\n/**\n * Generate icon component CSS\n */\nexport function generateIconCSS(prefix: string): string {\n return `\n.icon-${prefix} {\n display: inline-block;\n width: 1em;\n height: 1em;\n vertical-align: -0.125em;\n}\n\n.icon-${prefix} svg {\n width: 100%;\n height: 100%;\n}\n`.trim()\n}\n\nexport { type IconData as Icon }\n"
|
|
6
6
|
],
|
|
7
|
-
"mappings": "
|
|
8
|
-
"debugId": "
|
|
7
|
+
"mappings": ";AAuEO,SAAS,CAAU,CAAC,EAAoB,EAAmB,CAAC,EAAW,CAC5E,IACE,OACA,MAAO,EACP,OAAQ,EACR,QAAQ,eACR,QAAQ,GACR,QAAQ,GACR,SAAS,EACT,MAAO,EAAY,GACnB,MAAO,EAAc,IACnB,EAEE,EAAQ,GAAa,GAAQ,EAAS,OAAS,GAC/C,EAAS,GAAc,GAAQ,EAAS,QAAU,GAClD,EAAU,EAAS,SAAW,OAAO,EAAS,OAAS,MAAM,EAAS,QAAU,KAGhF,EAAuB,CAAC,EAC9B,GAAI,EACF,EAAW,KAAK,YAAY,EAC9B,GAAI,EACF,EAAW,KAAK,YAAY,EAC9B,GAAI,EAAQ,CACV,IAAM,EAAM,OAAO,IAAW,UAAY,EAAS,EAAI,EAAS,GAAK,EACrE,EAAW,KAAK,UAAU,OAAS,EAGrC,IAAM,EAAY,EAAW,OAAS,EAAI,EAAW,KAAK,GAAG,EAAI,GAC3D,EAAiB,EAAY,cAAc,KAAe,GAG1D,EAAmB,CAAC,EAC1B,GAAI,EACF,EAAO,KAAK,CAAc,EAC5B,GAAI,EACF,EAAO,KAAK,CAAW,EAEzB,IAAM,EAAQ,EAAO,OAAS,EAAI,WAAW,EAAO,KAAK,GAAG,KAAO,GAC7D,EAAY,EAAY,WAAW,KAAe,GAGpD,EAAO,EAAS,KACpB,GAAI,GAAS,IAAU,eACrB,EAAO,EAAK,QAAQ,gBAAiB,CAAK,EAG5C,MAAO,kDAAkD,cAAkB,eAAoB,KAAW,IAAY,KAAS,UAM1H,SAAS,CAAe,CAAC,EAAwB,CACtD,MAAO;AAAA,QACD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QAOA;AAAA;AAAA;AAAA;AAAA,EAIN,KAAK",
|
|
8
|
+
"debugId": "C1064E8941B4487D64756E2164756E21",
|
|
9
9
|
"names": []
|
|
10
10
|
}
|
package/package.json
CHANGED