@stacksjs/iconify-core 0.2.413 → 0.2.414

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 CHANGED
@@ -1,16 +1,16 @@
1
1
  // @bun
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} {
2
+ function I(t,a={}){let{size:i,width:p,height:u,color:n="currentColor",hFlip:m=!1,vFlip:d=!1,rotate:e=0,class:h="",style:l=""}=a,w=p||i||t.width||24,f=u||i||t.height||24,b=t.viewBox||`0 0 ${t.width||24} ${t.height||24}`,r=[];if(m)r.push("scaleX(-1)");if(d)r.push("scaleY(-1)");if(e){let x=typeof e==="number"&&e<4?e*90:e;r.push(`rotate(${x}deg)`)}let c=r.length>0?r.join(" "):"",g=c?`transform: ${c};`:"",s=[];if(g)s.push(g);if(l)s.push(l);let y=s.length>0?` style="${s.join(" ")}"`:"",v=h?` class="${h}"`:"",o=t.body;if(n&&n!=="currentColor")o=o.replace(/currentColor/g,n);return`<svg xmlns="http://www.w3.org/2000/svg" width="${w}" height="${f}" viewBox="${b}"${v}${y}>${o}</svg>`}function C(t){return`
3
+ .icon-${t} {
4
4
  display: inline-block;
5
5
  width: 1em;
6
6
  height: 1em;
7
7
  vertical-align: -0.125em;
8
8
  }
9
9
 
10
- .icon-${j} svg {
10
+ .icon-${t} svg {
11
11
  width: 100%;
12
12
  height: 100%;
13
13
  }
14
- `.trim()}export{B as renderIcon,C as generateIconCSS};
14
+ `.trim()}export{C as generateIconCSS,I as renderIcon};
15
15
 
16
- //# debugId=C1064E8941B4487D64756E2164756E21
16
+ //# debugId=9A85F7A7CC90989D64756E2164756E21
package/dist/index.js.map CHANGED
@@ -5,6 +5,6 @@
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
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",
8
+ "debugId": "9A85F7A7CC90989D64756E2164756E21",
9
9
  "names": []
10
10
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/iconify-core",
3
3
  "type": "module",
4
- "version": "0.2.413",
4
+ "version": "0.2.414",
5
5
  "description": "Core utilities for Iconify SVG icons in stx",
6
6
  "author": "Chris Breuer <chris@stacksjs.org>",
7
7
  "license": "MIT",