@cruxkit/icon 0.0.3 → 0.0.4

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 CHANGED
@@ -8,7 +8,7 @@
8
8
  </div>
9
9
 
10
10
  <div align="center">
11
- <img src="https://img.shields.io/badge/v-0.0.3-black"/>
11
+ <img src="https://img.shields.io/badge/v-0.0.4-black"/>
12
12
  <a href="https://github.com/cruxkit-org"><img src="https://img.shields.io/badge/🔥-@cruxkit-black"/></a>
13
13
  <br>
14
14
  <img src="https://img.shields.io/badge/coverage-99%25-brightgreen" alt="Test Coverage" />
package/dist/index.cjs CHANGED
@@ -1,3 +1,3 @@
1
- 'use strict';var jsxRuntime=require('@minejs/jsx/jsx-runtime');var a={"chevron-down":{category:"chevron",viewBox:"0 0 24 24",svg:'<path d="M6 9L12 15L18 9" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>'}};var e={...a},i={chevron:["chevron-down"]};var g={xs:"0.75rem",sm:"1rem",md:"1.25rem",lg:"1.5rem",xl:"2rem",xxl:"2.5rem"};function d(n){let o=typeof n=="string"?{name:n}:n,t=null;if(o.name&&o.name in e?t=e[o.name]:o.svg&&(t={viewBox:o.viewBox||"0 0 24 24",svg:o.svg}),!t)return o.name?console.warn(`Icon "${o.name}" not found in catalog`):console.warn("Icon configuration is invalid"),null;let r=o.size,s=typeof r=="number"?`${r}px`:g[r||"md"],c={width:s,height:s,display:"inline-block",verticalAlign:"middle",lineHeight:"1",flexShrink:"0"};return o.color&&(c.color=o.color),jsxRuntime.jsx("svg",{style:c,viewBox:t.viewBox,fill:"currentColor",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",dangerouslySetInnerHTML:{__html:t.svg}})}function w(n){return n in e}function h(){return Object.keys(e)}function N(n){return i[n]||[]}function k(){return Object.keys(i)}
2
- exports.Icon=d;exports.getIconCategories=k;exports.getIconNames=h;exports.getIconsByCategory=N;exports.iconCatalog=e;exports.iconExists=w;exports.sizeMap=g;//# sourceMappingURL=index.cjs.map
1
+ 'use strict';var jsxRuntime=require('@minejs/jsx/jsx-runtime');var l={"chevron-down":{category:"chevron",viewBox:"0 0 24 24",svg:'<path d="M6 9L12 15L18 9" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>'}};var a={flag:{category:"ui",viewBox:"0 0 448 512",svg:'<path opacity=".4" fill="currentColor" d="M64 48l69-17.2c38.1-9.5 78.3-5.1 113.5 12.5 46.3 23.2 100.8 23.2 147.1 0l9.6-4.8C423.8 28.1 448 43.1 448 66.1l0 247.7c0 13.3-8.3 25.3-20.8 30l-34.7 13c-46.2 17.3-97.6 14.6-141.7-7.4-37.9-19-81.4-23.7-122.5-13.4L64 352 64 48z"/><path fill="currentColor" d="M32 0C49.7 0 64 14.3 64 32l0 448c0 17.7-14.3 32-32 32S0 497.7 0 480L0 32C0 14.3 14.3 0 32 0z"/>'},language:{category:"ui",viewBox:"0 0 576 512",svg:'<path opacity=".4" fill="currentColor" d="M258.8 467c58.2-131 80.2-180.5 128-288 5.1-11.6 16.6-19 29.2-19s24.1 7.4 29.2 19l128 288c7.2 16.2-.1 35.1-16.2 42.2s-35.1-.1-42.2-16.2l-20-45-157.5 0-20 45c-7.2 16.2-26.1 23.4-42.2 16.2s-23.4-26.1-16.2-42.2zm106.9-83L466.3 384 416 270.8 365.7 384z"/><path fill="currentColor" d="M160 0c17.7 0 32 14.3 32 32l0 32 128 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-9.6 0-8.4 23.1c-16.4 45.2-41.1 86.5-72.2 122 14.2 8.8 29 16.6 44.4 23.5l50.4 22.4-26 58.5-50.4-22.4c-23-10.2-45-22.4-65.8-36.4-21.3 17.2-44.6 32.2-69.5 44.7L78.3 380.6c-15.8 7.9-35 1.5-42.9-14.3s-1.5-35 14.3-42.9l34.5-17.3c16.3-8.2 31.8-17.7 46.4-28.3-13.8-12.7-26.8-26.4-38.9-40.9L71.4 212.5c-11.3-13.6-9.5-33.8 4.1-45.1s33.8-9.5 45.1 4.1l20.3 24.4c11.5 13.9 24.1 26.8 37.4 38.7 27.5-30.4 49.2-66.1 63.5-105.4l.5-1.2-210.3 0C14.3 128 0 113.7 0 96S14.3 64 32 64l96 0 0-32c0-17.7 14.3-32 32-32z"/>'},moon:{category:"ui",viewBox:"0 0 512 512",svg:'<path opacity=".4" fill="currentColor" d="M256 0C114.6 0 0 114.6 0 256S114.6 512 256 512c68.8 0 131.3-27.2 177.3-71.4 7.3-7 9.4-17.9 5.3-27.1s-13.7-14.9-23.8-14.1c-4.9 .4-9.8 .6-14.8 .6-101.6 0-184-82.4-184-184 0-72.1 41.5-134.6 102.1-164.8 9.1-4.5 14.3-14.3 13.1-24.4S322.6 8.5 312.7 6.3C294.4 2.2 275.4 0 256 0z"/><path fill="currentColor" d=""/>'},sun:{category:"ui",viewBox:"0 0 512 512",svg:'<path opacity=".4" fill="currentColor" d="M0 256c0-13.3 10.7-24 24-24l56 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-56 0c-13.3 0-24-10.7-24-24zM75 75c9.4-9.4 24.6-9.4 33.9 0l39.6 39.6c9.4 9.4 9.4 24.6 0 33.9s-24.6 9.4-33.9 0L75 108.9c-9.4-9.4-9.4-24.6 0-33.9zm0 328.1l39.6-39.6c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9L108.9 437c-9.4 9.4-24.6 9.4-33.9 0s-9.4-24.6 0-33.9zM232 24c0-13.3 10.7-24 24-24s24 10.7 24 24l0 56c0 13.3-10.7 24-24 24s-24-10.7-24-24l0-56zm0 408c0-13.3 10.7-24 24-24s24 10.7 24 24l0 56c0 13.3-10.7 24-24 24s-24-10.7-24-24l0-56zM363.5 114.6L403.1 75c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9l-39.6 39.6c-9.4 9.4-24.6 9.4-33.9 0s-9.4-24.6 0-33.9zm0 248.9c9.4-9.4 24.6-9.4 33.9 0L437 403.1c9.4 9.4 9.4 24.6 0 33.9s-24.6 9.4-33.9 0l-39.6-39.6c-9.4-9.4-9.4-24.6 0-33.9zM408 256c0-13.3 10.7-24 24-24l56 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-56 0c-13.3 0-24-10.7-24-24z"/><path fill="currentColor" d="M144 256a112 112 0 1 1 224 0 112 112 0 1 1 -224 0z"/>'},user:{category:"ui",viewBox:"0 0 448 512",svg:'<path fill="currentColor" d="M224 248a120 120 0 1 0 0-240 120 120 0 1 0 0 240zm-29.7 56C95.8 304 16 383.8 16 482.3 16 498.7 29.3 512 45.7 512l356.6 0c16.4 0 29.7-13.3 29.7-29.7 0-98.5-79.8-178.3-178.3-178.3l-59.4 0z"/>'}};var n={...l,...a},c={chevron:["chevron-down"],ui:["flag","language","moon","sun","user"]};var g={xs:"0.75rem",sm:"1rem",md:"1.25rem",lg:"1.5rem",xl:"2rem",xxl:"2.5rem"};function z(e){let o=typeof e=="string"?{name:e}:e,t=null;if(o.name&&o.name in n?t=n[o.name]:o.svg&&(t={viewBox:o.viewBox||"0 0 24 24",svg:o.svg}),!t)return o.name?console.warn(`Icon "${o.name}" not found in catalog`):console.warn("Icon configuration is invalid"),null;let r=o.size,i=typeof r=="number"?`${r}px`:g[r||"md"],s={width:i,height:i,display:"inline-block",verticalAlign:"middle",lineHeight:"1",flexShrink:"0"};return o.color&&(s.color=o.color),jsxRuntime.jsx("svg",{style:s,viewBox:t.viewBox,fill:"currentColor",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",dangerouslySetInnerHTML:{__html:t.svg}})}function B(e){return e in n}function N(){return Object.keys(n)}function k(e){return c[e]||[]}function M(){return Object.keys(c)}
2
+ exports.Icon=z;exports.getIconCategories=M;exports.getIconNames=N;exports.getIconsByCategory=k;exports.iconCatalog=n;exports.iconExists=B;exports.sizeMap=g;//# sourceMappingURL=index.cjs.map
3
3
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/kit/categories/chevron.ts","../src/kit/categories/index.ts","../src/kit/icon.tsx"],"names":["chevronIcons","iconCatalog","iconsByCategory","sizeMap","Icon","props","cfg","iconData","sizeValue","size","style","jsx","iconExists","name","getIconNames","getIconsByCategory","category","getIconCategories"],"mappings":"+DAAO,IAAMA,CAAAA,CAAe,CAC1B,cAAA,CAAgB,CACd,SAAU,SAAA,CACV,OAAA,CAAS,YACT,GAAA,CAAK,8GACP,CACF,CAAA,CCJO,IAAMC,EAAc,CACzB,GAAGD,CACL,CAAA,CAIaE,CAAAA,CAAkB,CAC7B,OAAA,CAAW,CAAC,cAAc,CAC5B,MCQiBC,CAAAA,CAAkC,CAC3C,GAAU,SAAA,CACV,EAAA,CAAU,OACV,EAAA,CAAU,SAAA,CACV,GAAU,QAAA,CACV,EAAA,CAAU,OACV,GAAA,CAAU,QACd,EAgBO,SAASC,CAAAA,CAAKC,CAAAA,CAAsC,CAWvD,IAAMC,CAAAA,CADS,OAAOD,CAAAA,EAAU,QAAA,CAAW,CAAE,IAAA,CAAMA,CAAM,EAAIA,CAAAA,CAGzDE,CAAAA,CAAoD,KAWxD,GATID,CAAAA,CAAI,MAAQA,CAAAA,CAAI,IAAA,IAAQL,EACxBM,CAAAA,CAAWN,CAAAA,CAAYK,CAAAA,CAAI,IAAgB,CAAA,CACpCA,CAAAA,CAAI,MACXC,CAAAA,CAAW,CACP,QAAUD,CAAAA,CAAI,OAAA,EAAW,YACzB,GAAA,CAAUA,CAAAA,CAAI,GAClB,CAAA,CAAA,CAGA,CAACC,EACD,OAAID,CAAAA,CAAI,KACJ,OAAA,CAAQ,IAAA,CAAK,SAASA,CAAAA,CAAI,IAAI,CAAA,sBAAA,CAAwB,CAAA,CAEtD,OAAA,CAAQ,IAAA,CAAK,+BAA+B,CAAA,CAEzC,IAAA,CAGX,IAAME,CAAAA,CAAYF,CAAAA,CAAI,KAEhBG,CAAAA,CAAO,OAAOD,GAAc,QAAA,CAC5B,CAAA,EAAGA,CAAS,CAAA,EAAA,CAAA,CACZL,CAAAA,CAAQK,GAAa,IAAI,CAAA,CAEzBE,EAAgC,CAClC,KAAA,CAA0BD,CAAAA,CAC1B,MAAA,CAA0BA,CAAAA,CAC1B,OAAA,CAA0B,eAC1B,aAAA,CAA0B,QAAA,CAC1B,WAA0B,GAAA,CAC1B,UAAA,CAA0B,GAC9B,CAAA,CAEA,OAAIH,EAAI,KAAA,GAAOI,CAAAA,CAAM,MAAQJ,CAAAA,CAAI,KAAA,CAAA,CAG7BK,eAAC,KAAA,CAAA,CACG,KAAA,CAAuBD,EACvB,OAAA,CAAuBH,CAAAA,CAAS,OAAA,CAChC,IAAA,CAAsB,cAAA,CACtB,KAAA,CAAsB,6BACtB,aAAA,CAAsB,MAAA,CACtB,KAAsB,KAAA,CACtB,uBAAA,CAA2B,CACvB,MAAA,CAAkBA,CAAAA,CAAS,GAC/B,CAAA,CACJ,CAER,CAKO,SAASK,CAAAA,CAAWC,EAAgC,CACvD,OAAOA,KAAQZ,CACnB,CAKO,SAASa,CAAAA,EAA2B,CACvC,OAAO,OAAO,IAAA,CAAKb,CAAW,CAClC,CAKO,SAASc,EAAmBC,CAAAA,CAA8B,CAC7D,OAAQd,CAAAA,CAAgBc,CAAwC,GAAK,EACzE,CAKO,SAASC,CAAAA,EAA8B,CAC1C,OAAO,MAAA,CAAO,IAAA,CAAKf,CAAe,CACtC","file":"index.cjs","sourcesContent":["export const chevronIcons = {\n 'chevron-down': {\n category: 'chevron',\n viewBox: '0 0 24 24',\n svg: `<path d=\"M6 9L12 15L18 9\" stroke=\"#000000\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>`,\n },\n} as const;\n\nexport type ChevronIconName = keyof typeof chevronIcons;\n","import { chevronIcons } from './chevron';\n\nexport const iconCatalog = {\n ...chevronIcons,\n} as const;\n\nexport type IconName = keyof typeof iconCatalog;\n\nexport const iconsByCategory = {\n 'chevron': ['chevron-down'],\n} as const;\n","// src/kit/icon.tsx\r\n//\r\n// Made with ❤️ by Maysara.\r\n\r\n\r\n\r\n// ╔════════════════════════════════════════ PACK ════════════════════════════════════════╗\r\n\r\n import { JSXElement } from '@minejs/jsx';\r\n import { IconProps, iconCatalog, type IconName } from '../types';\r\n import { iconsByCategory } from './categories';\r\n\r\n// ╚══════════════════════════════════════════════════════════════════════════════════════╝\r\n\r\n\r\n\r\n// ╔════════════════════════════════════════ INIT ════════════════════════════════════════╗\r\n\r\n export const sizeMap: Record<string, string> = {\r\n xs : '0.75rem',\r\n sm : '1rem',\r\n md : '1.25rem',\r\n lg : '1.5rem',\r\n xl : '2rem',\r\n 'xxl' : '2.5rem'\r\n };\r\n\r\n// ╚══════════════════════════════════════════════════════════════════════════════════════╝\r\n\r\n\r\n\r\n// ╔════════════════════════════════════════ CORE ════════════════════════════════════════╗\r\n\r\n /**\r\n * Icon Component\r\n * Renders inline SVG icons with various options\r\n *\r\n * @example\r\n * Icon('check')\r\n * Icon({ name: 'spinner', spin: true, size: 'lg' })\r\n */\r\n export function Icon(props: IconProps) : JSXElement | null {\r\n\r\n interface IconLikeConfig {\r\n name? : string\r\n size? : number | string\r\n color? : string\r\n svg? : string\r\n viewBox? : string\r\n }\r\n\r\n const config = typeof props === 'string' ? { name: props } : props;\r\n const cfg = config as IconLikeConfig;\r\n\r\n let iconData: { viewBox: string; svg: string } | null = null;\r\n\r\n if (cfg.name && cfg.name in iconCatalog) {\r\n iconData = iconCatalog[cfg.name as IconName] as { viewBox: string; svg: string };\r\n } else if (cfg.svg) {\r\n iconData = {\r\n viewBox : cfg.viewBox || '0 0 24 24',\r\n svg : cfg.svg\r\n };\r\n }\r\n\r\n if (!iconData) {\r\n if (cfg.name) {\r\n console.warn(`Icon \"${cfg.name}\" not found in catalog`);\r\n } else {\r\n console.warn('Icon configuration is invalid');\r\n }\r\n return null;\r\n }\r\n\r\n const sizeValue = cfg.size;\r\n\r\n const size = typeof sizeValue === 'number'\r\n ? `${sizeValue}px`\r\n : sizeMap[sizeValue || 'md'];\r\n\r\n const style: Record<string, string> = {\r\n width : size,\r\n height : size,\r\n display : 'inline-block',\r\n verticalAlign : 'middle',\r\n lineHeight : '1',\r\n flexShrink : '0'\r\n };\r\n\r\n if (cfg.color) style.color = cfg.color;\r\n\r\n return (\r\n <svg\r\n style = {style}\r\n viewBox = {iconData.viewBox}\r\n fill = \"currentColor\"\r\n xmlns = \"http://www.w3.org/2000/svg\"\r\n aria-hidden = \"true\"\r\n role = \"img\"\r\n dangerouslySetInnerHTML = {{\r\n __html : iconData.svg\r\n }}\r\n />\r\n );\r\n }\r\n\r\n /**\r\n * Utility function to check if an icon exists\r\n */\r\n export function iconExists(name: string): name is IconName {\r\n return name in iconCatalog;\r\n }\r\n\r\n /**\r\n * Get all available icon names\r\n */\r\n export function getIconNames(): IconName[] {\r\n return Object.keys(iconCatalog) as IconName[];\r\n }\r\n\r\n /**\r\n * Get icons by category\r\n */\r\n export function getIconsByCategory(category: string): IconName[] {\r\n return (iconsByCategory[category as keyof typeof iconsByCategory] || []) as unknown as IconName[];\r\n }\r\n\r\n /**\r\n * Get all available categories\r\n */\r\n export function getIconCategories(): string[] {\r\n return Object.keys(iconsByCategory);\r\n }\r\n\r\n// ╚══════════════════════════════════════════════════════════════════════════════════════╝\r\n"]}
1
+ {"version":3,"sources":["../src/kit/categories/chevron.ts","../src/kit/categories/ui.ts","../src/kit/categories/index.ts","../src/kit/icon.tsx"],"names":["chevronIcons","uiIcons","iconCatalog","iconsByCategory","sizeMap","Icon","props","cfg","iconData","sizeValue","size","style","jsx","iconExists","name","getIconNames","getIconsByCategory","category","getIconCategories"],"mappings":"+DAAO,IAAMA,CAAAA,CAAe,CAC1B,cAAA,CAAgB,CACd,QAAA,CAAU,SAAA,CACV,OAAA,CAAS,WAAA,CACT,GAAA,CAAK,8GACP,CACF,CAAA,CCNO,IAAMC,CAAAA,CAAU,CACrB,IAAA,CAAQ,CACN,QAAA,CAAU,IAAA,CACV,OAAA,CAAS,aAAA,CACT,GAAA,CAAK,2YACP,CAAA,CAC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A,CAAKf,CAAe,CACtC","file":"index.cjs","sourcesContent":["export const chevronIcons = {\n 'chevron-down': {\n category: 'chevron',\n viewBox: '0 0 24 24',\n svg: `<path d=\"M6 9L12 15L18 9\" stroke=\"#000000\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>`,\n },\n} as const;\n\nexport type ChevronIconName = keyof typeof chevronIcons;\n","export const uiIcons = {\n 'flag': {\n category: 'ui',\n viewBox: '0 0 448 512',\n svg: `<path opacity=\".4\" fill=\"currentColor\" d=\"M64 48l69-17.2c38.1-9.5 78.3-5.1 113.5 12.5 46.3 23.2 100.8 23.2 147.1 0l9.6-4.8C423.8 28.1 448 43.1 448 66.1l0 247.7c0 13.3-8.3 25.3-20.8 30l-34.7 13c-46.2 17.3-97.6 14.6-141.7-7.4-37.9-19-81.4-23.7-122.5-13.4L64 352 64 48z\"/><path fill=\"currentColor\" d=\"M32 0C49.7 0 64 14.3 64 32l0 448c0 17.7-14.3 32-32 32S0 497.7 0 480L0 32C0 14.3 14.3 0 32 0z\"/>`,\n },\n 'language': {\n category: 'ui',\n viewBox: '0 0 576 512',\n svg: `<path opacity=\".4\" fill=\"currentColor\" d=\"M258.8 467c58.2-131 80.2-180.5 128-288 5.1-11.6 16.6-19 29.2-19s24.1 7.4 29.2 19l128 288c7.2 16.2-.1 35.1-16.2 42.2s-35.1-.1-42.2-16.2l-20-45-157.5 0-20 45c-7.2 16.2-26.1 23.4-42.2 16.2s-23.4-26.1-16.2-42.2zm106.9-83L466.3 384 416 270.8 365.7 384z\"/><path fill=\"currentColor\" d=\"M160 0c17.7 0 32 14.3 32 32l0 32 128 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-9.6 0-8.4 23.1c-16.4 45.2-41.1 86.5-72.2 122 14.2 8.8 29 16.6 44.4 23.5l50.4 22.4-26 58.5-50.4-22.4c-23-10.2-45-22.4-65.8-36.4-21.3 17.2-44.6 32.2-69.5 44.7L78.3 380.6c-15.8 7.9-35 1.5-42.9-14.3s-1.5-35 14.3-42.9l34.5-17.3c16.3-8.2 31.8-17.7 46.4-28.3-13.8-12.7-26.8-26.4-38.9-40.9L71.4 212.5c-11.3-13.6-9.5-33.8 4.1-45.1s33.8-9.5 45.1 4.1l20.3 24.4c11.5 13.9 24.1 26.8 37.4 38.7 27.5-30.4 49.2-66.1 63.5-105.4l.5-1.2-210.3 0C14.3 128 0 113.7 0 96S14.3 64 32 64l96 0 0-32c0-17.7 14.3-32 32-32z\"/>`,\n },\n 'moon': {\n category: 'ui',\n viewBox: '0 0 512 512',\n svg: `<path opacity=\".4\" fill=\"currentColor\" d=\"M256 0C114.6 0 0 114.6 0 256S114.6 512 256 512c68.8 0 131.3-27.2 177.3-71.4 7.3-7 9.4-17.9 5.3-27.1s-13.7-14.9-23.8-14.1c-4.9 .4-9.8 .6-14.8 .6-101.6 0-184-82.4-184-184 0-72.1 41.5-134.6 102.1-164.8 9.1-4.5 14.3-14.3 13.1-24.4S322.6 8.5 312.7 6.3C294.4 2.2 275.4 0 256 0z\"/><path fill=\"currentColor\" d=\"\"/>`,\n },\n 'sun': {\n category: 'ui',\n viewBox: '0 0 512 512',\n svg: `<path opacity=\".4\" fill=\"currentColor\" d=\"M0 256c0-13.3 10.7-24 24-24l56 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-56 0c-13.3 0-24-10.7-24-24zM75 75c9.4-9.4 24.6-9.4 33.9 0l39.6 39.6c9.4 9.4 9.4 24.6 0 33.9s-24.6 9.4-33.9 0L75 108.9c-9.4-9.4-9.4-24.6 0-33.9zm0 328.1l39.6-39.6c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9L108.9 437c-9.4 9.4-24.6 9.4-33.9 0s-9.4-24.6 0-33.9zM232 24c0-13.3 10.7-24 24-24s24 10.7 24 24l0 56c0 13.3-10.7 24-24 24s-24-10.7-24-24l0-56zm0 408c0-13.3 10.7-24 24-24s24 10.7 24 24l0 56c0 13.3-10.7 24-24 24s-24-10.7-24-24l0-56zM363.5 114.6L403.1 75c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9l-39.6 39.6c-9.4 9.4-24.6 9.4-33.9 0s-9.4-24.6 0-33.9zm0 248.9c9.4-9.4 24.6-9.4 33.9 0L437 403.1c9.4 9.4 9.4 24.6 0 33.9s-24.6 9.4-33.9 0l-39.6-39.6c-9.4-9.4-9.4-24.6 0-33.9zM408 256c0-13.3 10.7-24 24-24l56 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-56 0c-13.3 0-24-10.7-24-24z\"/><path fill=\"currentColor\" d=\"M144 256a112 112 0 1 1 224 0 112 112 0 1 1 -224 0z\"/>`,\n },\n 'user': {\n category: 'ui',\n viewBox: '0 0 448 512',\n svg: `<path fill=\"currentColor\" d=\"M224 248a120 120 0 1 0 0-240 120 120 0 1 0 0 240zm-29.7 56C95.8 304 16 383.8 16 482.3 16 498.7 29.3 512 45.7 512l356.6 0c16.4 0 29.7-13.3 29.7-29.7 0-98.5-79.8-178.3-178.3-178.3l-59.4 0z\"/>`,\n },\n} as const;\n\nexport type UiIconName = keyof typeof uiIcons;\n","import { chevronIcons } from './chevron';\nimport { uiIcons } from './ui';\n\nexport const iconCatalog = {\n ...chevronIcons,\n ...uiIcons,\n} as const;\n\nexport type IconName = keyof typeof iconCatalog;\n\nexport const iconsByCategory = {\n 'chevron': ['chevron-down'],\n 'ui': ['flag', 'language', 'moon', 'sun', 'user'],\n} as const;\n","// src/kit/icon.tsx\r\n//\r\n// Made with ❤️ by Maysara.\r\n\r\n\r\n\r\n// ╔════════════════════════════════════════ PACK ════════════════════════════════════════╗\r\n\r\n import { JSXElement } from '@minejs/jsx';\r\n import { IconProps, iconCatalog, type IconName } from '../types';\r\n import { iconsByCategory } from './categories';\r\n\r\n// ╚══════════════════════════════════════════════════════════════════════════════════════╝\r\n\r\n\r\n\r\n// ╔════════════════════════════════════════ INIT ════════════════════════════════════════╗\r\n\r\n export const sizeMap: Record<string, string> = {\r\n xs : '0.75rem',\r\n sm : '1rem',\r\n md : '1.25rem',\r\n lg : '1.5rem',\r\n xl : '2rem',\r\n 'xxl' : '2.5rem'\r\n };\r\n\r\n// ╚══════════════════════════════════════════════════════════════════════════════════════╝\r\n\r\n\r\n\r\n// ╔════════════════════════════════════════ CORE ════════════════════════════════════════╗\r\n\r\n /**\r\n * Icon Component\r\n * Renders inline SVG icons with various options\r\n *\r\n * @example\r\n * Icon('check')\r\n * Icon({ name: 'spinner', spin: true, size: 'lg' })\r\n */\r\n export function Icon(props: IconProps) : JSXElement | null {\r\n\r\n interface IconLikeConfig {\r\n name? : string\r\n size? : number | string\r\n color? : string\r\n svg? : string\r\n viewBox? : string\r\n }\r\n\r\n const config = typeof props === 'string' ? { name: props } : props;\r\n const cfg = config as IconLikeConfig;\r\n\r\n let iconData: { viewBox: string; svg: string } | null = null;\r\n\r\n if (cfg.name && cfg.name in iconCatalog) {\r\n iconData = iconCatalog[cfg.name as IconName] as { viewBox: string; svg: string };\r\n } else if (cfg.svg) {\r\n iconData = {\r\n viewBox : cfg.viewBox || '0 0 24 24',\r\n svg : cfg.svg\r\n };\r\n }\r\n\r\n if (!iconData) {\r\n if (cfg.name) {\r\n console.warn(`Icon \"${cfg.name}\" not found in catalog`);\r\n } else {\r\n console.warn('Icon configuration is invalid');\r\n }\r\n return null;\r\n }\r\n\r\n const sizeValue = cfg.size;\r\n\r\n const size = typeof sizeValue === 'number'\r\n ? `${sizeValue}px`\r\n : sizeMap[sizeValue || 'md'];\r\n\r\n const style: Record<string, string> = {\r\n width : size,\r\n height : size,\r\n display : 'inline-block',\r\n verticalAlign : 'middle',\r\n lineHeight : '1',\r\n flexShrink : '0'\r\n };\r\n\r\n if (cfg.color) style.color = cfg.color;\r\n\r\n return (\r\n <svg\r\n style = {style}\r\n viewBox = {iconData.viewBox}\r\n fill = \"currentColor\"\r\n xmlns = \"http://www.w3.org/2000/svg\"\r\n aria-hidden = \"true\"\r\n role = \"img\"\r\n dangerouslySetInnerHTML = {{\r\n __html : iconData.svg\r\n }}\r\n />\r\n );\r\n }\r\n\r\n /**\r\n * Utility function to check if an icon exists\r\n */\r\n export function iconExists(name: string): name is IconName {\r\n return name in iconCatalog;\r\n }\r\n\r\n /**\r\n * Get all available icon names\r\n */\r\n export function getIconNames(): IconName[] {\r\n return Object.keys(iconCatalog) as IconName[];\r\n }\r\n\r\n /**\r\n * Get icons by category\r\n */\r\n export function getIconsByCategory(category: string): IconName[] {\r\n return (iconsByCategory[category as keyof typeof iconsByCategory] || []) as unknown as IconName[];\r\n }\r\n\r\n /**\r\n * Get all available categories\r\n */\r\n export function getIconCategories(): string[] {\r\n return Object.keys(iconsByCategory);\r\n }\r\n\r\n// ╚══════════════════════════════════════════════════════════════════════════════════════╝\r\n"]}
package/dist/index.d.cts CHANGED
@@ -1,6 +1,31 @@
1
1
  import { JSXElement } from '@minejs/jsx';
2
2
 
3
3
  declare const iconCatalog: {
4
+ readonly flag: {
5
+ readonly category: "ui";
6
+ readonly viewBox: "0 0 448 512";
7
+ readonly svg: "<path opacity=\".4\" fill=\"currentColor\" d=\"M64 48l69-17.2c38.1-9.5 78.3-5.1 113.5 12.5 46.3 23.2 100.8 23.2 147.1 0l9.6-4.8C423.8 28.1 448 43.1 448 66.1l0 247.7c0 13.3-8.3 25.3-20.8 30l-34.7 13c-46.2 17.3-97.6 14.6-141.7-7.4-37.9-19-81.4-23.7-122.5-13.4L64 352 64 48z\"/><path fill=\"currentColor\" d=\"M32 0C49.7 0 64 14.3 64 32l0 448c0 17.7-14.3 32-32 32S0 497.7 0 480L0 32C0 14.3 14.3 0 32 0z\"/>";
8
+ };
9
+ readonly language: {
10
+ readonly category: "ui";
11
+ readonly viewBox: "0 0 576 512";
12
+ readonly svg: "<path opacity=\".4\" fill=\"currentColor\" d=\"M258.8 467c58.2-131 80.2-180.5 128-288 5.1-11.6 16.6-19 29.2-19s24.1 7.4 29.2 19l128 288c7.2 16.2-.1 35.1-16.2 42.2s-35.1-.1-42.2-16.2l-20-45-157.5 0-20 45c-7.2 16.2-26.1 23.4-42.2 16.2s-23.4-26.1-16.2-42.2zm106.9-83L466.3 384 416 270.8 365.7 384z\"/><path fill=\"currentColor\" d=\"M160 0c17.7 0 32 14.3 32 32l0 32 128 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-9.6 0-8.4 23.1c-16.4 45.2-41.1 86.5-72.2 122 14.2 8.8 29 16.6 44.4 23.5l50.4 22.4-26 58.5-50.4-22.4c-23-10.2-45-22.4-65.8-36.4-21.3 17.2-44.6 32.2-69.5 44.7L78.3 380.6c-15.8 7.9-35 1.5-42.9-14.3s-1.5-35 14.3-42.9l34.5-17.3c16.3-8.2 31.8-17.7 46.4-28.3-13.8-12.7-26.8-26.4-38.9-40.9L71.4 212.5c-11.3-13.6-9.5-33.8 4.1-45.1s33.8-9.5 45.1 4.1l20.3 24.4c11.5 13.9 24.1 26.8 37.4 38.7 27.5-30.4 49.2-66.1 63.5-105.4l.5-1.2-210.3 0C14.3 128 0 113.7 0 96S14.3 64 32 64l96 0 0-32c0-17.7 14.3-32 32-32z\"/>";
13
+ };
14
+ readonly moon: {
15
+ readonly category: "ui";
16
+ readonly viewBox: "0 0 512 512";
17
+ readonly svg: "<path opacity=\".4\" fill=\"currentColor\" d=\"M256 0C114.6 0 0 114.6 0 256S114.6 512 256 512c68.8 0 131.3-27.2 177.3-71.4 7.3-7 9.4-17.9 5.3-27.1s-13.7-14.9-23.8-14.1c-4.9 .4-9.8 .6-14.8 .6-101.6 0-184-82.4-184-184 0-72.1 41.5-134.6 102.1-164.8 9.1-4.5 14.3-14.3 13.1-24.4S322.6 8.5 312.7 6.3C294.4 2.2 275.4 0 256 0z\"/><path fill=\"currentColor\" d=\"\"/>";
18
+ };
19
+ readonly sun: {
20
+ readonly category: "ui";
21
+ readonly viewBox: "0 0 512 512";
22
+ readonly svg: "<path opacity=\".4\" fill=\"currentColor\" d=\"M0 256c0-13.3 10.7-24 24-24l56 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-56 0c-13.3 0-24-10.7-24-24zM75 75c9.4-9.4 24.6-9.4 33.9 0l39.6 39.6c9.4 9.4 9.4 24.6 0 33.9s-24.6 9.4-33.9 0L75 108.9c-9.4-9.4-9.4-24.6 0-33.9zm0 328.1l39.6-39.6c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9L108.9 437c-9.4 9.4-24.6 9.4-33.9 0s-9.4-24.6 0-33.9zM232 24c0-13.3 10.7-24 24-24s24 10.7 24 24l0 56c0 13.3-10.7 24-24 24s-24-10.7-24-24l0-56zm0 408c0-13.3 10.7-24 24-24s24 10.7 24 24l0 56c0 13.3-10.7 24-24 24s-24-10.7-24-24l0-56zM363.5 114.6L403.1 75c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9l-39.6 39.6c-9.4 9.4-24.6 9.4-33.9 0s-9.4-24.6 0-33.9zm0 248.9c9.4-9.4 24.6-9.4 33.9 0L437 403.1c9.4 9.4 9.4 24.6 0 33.9s-24.6 9.4-33.9 0l-39.6-39.6c-9.4-9.4-9.4-24.6 0-33.9zM408 256c0-13.3 10.7-24 24-24l56 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-56 0c-13.3 0-24-10.7-24-24z\"/><path fill=\"currentColor\" d=\"M144 256a112 112 0 1 1 224 0 112 112 0 1 1 -224 0z\"/>";
23
+ };
24
+ readonly user: {
25
+ readonly category: "ui";
26
+ readonly viewBox: "0 0 448 512";
27
+ readonly svg: "<path fill=\"currentColor\" d=\"M224 248a120 120 0 1 0 0-240 120 120 0 1 0 0 240zm-29.7 56C95.8 304 16 383.8 16 482.3 16 498.7 29.3 512 45.7 512l356.6 0c16.4 0 29.7-13.3 29.7-29.7 0-98.5-79.8-178.3-178.3-178.3l-59.4 0z\"/>";
28
+ };
4
29
  readonly 'chevron-down': {
5
30
  readonly category: "chevron";
6
31
  readonly viewBox: "0 0 24 24";
package/dist/index.d.ts CHANGED
@@ -1,6 +1,31 @@
1
1
  import { JSXElement } from '@minejs/jsx';
2
2
 
3
3
  declare const iconCatalog: {
4
+ readonly flag: {
5
+ readonly category: "ui";
6
+ readonly viewBox: "0 0 448 512";
7
+ readonly svg: "<path opacity=\".4\" fill=\"currentColor\" d=\"M64 48l69-17.2c38.1-9.5 78.3-5.1 113.5 12.5 46.3 23.2 100.8 23.2 147.1 0l9.6-4.8C423.8 28.1 448 43.1 448 66.1l0 247.7c0 13.3-8.3 25.3-20.8 30l-34.7 13c-46.2 17.3-97.6 14.6-141.7-7.4-37.9-19-81.4-23.7-122.5-13.4L64 352 64 48z\"/><path fill=\"currentColor\" d=\"M32 0C49.7 0 64 14.3 64 32l0 448c0 17.7-14.3 32-32 32S0 497.7 0 480L0 32C0 14.3 14.3 0 32 0z\"/>";
8
+ };
9
+ readonly language: {
10
+ readonly category: "ui";
11
+ readonly viewBox: "0 0 576 512";
12
+ readonly svg: "<path opacity=\".4\" fill=\"currentColor\" d=\"M258.8 467c58.2-131 80.2-180.5 128-288 5.1-11.6 16.6-19 29.2-19s24.1 7.4 29.2 19l128 288c7.2 16.2-.1 35.1-16.2 42.2s-35.1-.1-42.2-16.2l-20-45-157.5 0-20 45c-7.2 16.2-26.1 23.4-42.2 16.2s-23.4-26.1-16.2-42.2zm106.9-83L466.3 384 416 270.8 365.7 384z\"/><path fill=\"currentColor\" d=\"M160 0c17.7 0 32 14.3 32 32l0 32 128 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-9.6 0-8.4 23.1c-16.4 45.2-41.1 86.5-72.2 122 14.2 8.8 29 16.6 44.4 23.5l50.4 22.4-26 58.5-50.4-22.4c-23-10.2-45-22.4-65.8-36.4-21.3 17.2-44.6 32.2-69.5 44.7L78.3 380.6c-15.8 7.9-35 1.5-42.9-14.3s-1.5-35 14.3-42.9l34.5-17.3c16.3-8.2 31.8-17.7 46.4-28.3-13.8-12.7-26.8-26.4-38.9-40.9L71.4 212.5c-11.3-13.6-9.5-33.8 4.1-45.1s33.8-9.5 45.1 4.1l20.3 24.4c11.5 13.9 24.1 26.8 37.4 38.7 27.5-30.4 49.2-66.1 63.5-105.4l.5-1.2-210.3 0C14.3 128 0 113.7 0 96S14.3 64 32 64l96 0 0-32c0-17.7 14.3-32 32-32z\"/>";
13
+ };
14
+ readonly moon: {
15
+ readonly category: "ui";
16
+ readonly viewBox: "0 0 512 512";
17
+ readonly svg: "<path opacity=\".4\" fill=\"currentColor\" d=\"M256 0C114.6 0 0 114.6 0 256S114.6 512 256 512c68.8 0 131.3-27.2 177.3-71.4 7.3-7 9.4-17.9 5.3-27.1s-13.7-14.9-23.8-14.1c-4.9 .4-9.8 .6-14.8 .6-101.6 0-184-82.4-184-184 0-72.1 41.5-134.6 102.1-164.8 9.1-4.5 14.3-14.3 13.1-24.4S322.6 8.5 312.7 6.3C294.4 2.2 275.4 0 256 0z\"/><path fill=\"currentColor\" d=\"\"/>";
18
+ };
19
+ readonly sun: {
20
+ readonly category: "ui";
21
+ readonly viewBox: "0 0 512 512";
22
+ readonly svg: "<path opacity=\".4\" fill=\"currentColor\" d=\"M0 256c0-13.3 10.7-24 24-24l56 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-56 0c-13.3 0-24-10.7-24-24zM75 75c9.4-9.4 24.6-9.4 33.9 0l39.6 39.6c9.4 9.4 9.4 24.6 0 33.9s-24.6 9.4-33.9 0L75 108.9c-9.4-9.4-9.4-24.6 0-33.9zm0 328.1l39.6-39.6c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9L108.9 437c-9.4 9.4-24.6 9.4-33.9 0s-9.4-24.6 0-33.9zM232 24c0-13.3 10.7-24 24-24s24 10.7 24 24l0 56c0 13.3-10.7 24-24 24s-24-10.7-24-24l0-56zm0 408c0-13.3 10.7-24 24-24s24 10.7 24 24l0 56c0 13.3-10.7 24-24 24s-24-10.7-24-24l0-56zM363.5 114.6L403.1 75c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9l-39.6 39.6c-9.4 9.4-24.6 9.4-33.9 0s-9.4-24.6 0-33.9zm0 248.9c9.4-9.4 24.6-9.4 33.9 0L437 403.1c9.4 9.4 9.4 24.6 0 33.9s-24.6 9.4-33.9 0l-39.6-39.6c-9.4-9.4-9.4-24.6 0-33.9zM408 256c0-13.3 10.7-24 24-24l56 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-56 0c-13.3 0-24-10.7-24-24z\"/><path fill=\"currentColor\" d=\"M144 256a112 112 0 1 1 224 0 112 112 0 1 1 -224 0z\"/>";
23
+ };
24
+ readonly user: {
25
+ readonly category: "ui";
26
+ readonly viewBox: "0 0 448 512";
27
+ readonly svg: "<path fill=\"currentColor\" d=\"M224 248a120 120 0 1 0 0-240 120 120 0 1 0 0 240zm-29.7 56C95.8 304 16 383.8 16 482.3 16 498.7 29.3 512 45.7 512l356.6 0c16.4 0 29.7-13.3 29.7-29.7 0-98.5-79.8-178.3-178.3-178.3l-59.4 0z\"/>";
28
+ };
4
29
  readonly 'chevron-down': {
5
30
  readonly category: "chevron";
6
31
  readonly viewBox: "0 0 24 24";
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- import {jsx}from'@minejs/jsx/jsx-runtime';var a={"chevron-down":{category:"chevron",viewBox:"0 0 24 24",svg:'<path d="M6 9L12 15L18 9" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>'}};var e={...a},i={chevron:["chevron-down"]};var g={xs:"0.75rem",sm:"1rem",md:"1.25rem",lg:"1.5rem",xl:"2rem",xxl:"2.5rem"};function d(n){let o=typeof n=="string"?{name:n}:n,t=null;if(o.name&&o.name in e?t=e[o.name]:o.svg&&(t={viewBox:o.viewBox||"0 0 24 24",svg:o.svg}),!t)return o.name?console.warn(`Icon "${o.name}" not found in catalog`):console.warn("Icon configuration is invalid"),null;let r=o.size,s=typeof r=="number"?`${r}px`:g[r||"md"],c={width:s,height:s,display:"inline-block",verticalAlign:"middle",lineHeight:"1",flexShrink:"0"};return o.color&&(c.color=o.color),jsx("svg",{style:c,viewBox:t.viewBox,fill:"currentColor",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",dangerouslySetInnerHTML:{__html:t.svg}})}function w(n){return n in e}function h(){return Object.keys(e)}function N(n){return i[n]||[]}function k(){return Object.keys(i)}
2
- export{d as Icon,k as getIconCategories,h as getIconNames,N as getIconsByCategory,e as iconCatalog,w as iconExists,g as sizeMap};//# sourceMappingURL=index.js.map
1
+ import {jsx}from'@minejs/jsx/jsx-runtime';var l={"chevron-down":{category:"chevron",viewBox:"0 0 24 24",svg:'<path d="M6 9L12 15L18 9" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>'}};var a={flag:{category:"ui",viewBox:"0 0 448 512",svg:'<path opacity=".4" fill="currentColor" d="M64 48l69-17.2c38.1-9.5 78.3-5.1 113.5 12.5 46.3 23.2 100.8 23.2 147.1 0l9.6-4.8C423.8 28.1 448 43.1 448 66.1l0 247.7c0 13.3-8.3 25.3-20.8 30l-34.7 13c-46.2 17.3-97.6 14.6-141.7-7.4-37.9-19-81.4-23.7-122.5-13.4L64 352 64 48z"/><path fill="currentColor" d="M32 0C49.7 0 64 14.3 64 32l0 448c0 17.7-14.3 32-32 32S0 497.7 0 480L0 32C0 14.3 14.3 0 32 0z"/>'},language:{category:"ui",viewBox:"0 0 576 512",svg:'<path opacity=".4" fill="currentColor" d="M258.8 467c58.2-131 80.2-180.5 128-288 5.1-11.6 16.6-19 29.2-19s24.1 7.4 29.2 19l128 288c7.2 16.2-.1 35.1-16.2 42.2s-35.1-.1-42.2-16.2l-20-45-157.5 0-20 45c-7.2 16.2-26.1 23.4-42.2 16.2s-23.4-26.1-16.2-42.2zm106.9-83L466.3 384 416 270.8 365.7 384z"/><path fill="currentColor" d="M160 0c17.7 0 32 14.3 32 32l0 32 128 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-9.6 0-8.4 23.1c-16.4 45.2-41.1 86.5-72.2 122 14.2 8.8 29 16.6 44.4 23.5l50.4 22.4-26 58.5-50.4-22.4c-23-10.2-45-22.4-65.8-36.4-21.3 17.2-44.6 32.2-69.5 44.7L78.3 380.6c-15.8 7.9-35 1.5-42.9-14.3s-1.5-35 14.3-42.9l34.5-17.3c16.3-8.2 31.8-17.7 46.4-28.3-13.8-12.7-26.8-26.4-38.9-40.9L71.4 212.5c-11.3-13.6-9.5-33.8 4.1-45.1s33.8-9.5 45.1 4.1l20.3 24.4c11.5 13.9 24.1 26.8 37.4 38.7 27.5-30.4 49.2-66.1 63.5-105.4l.5-1.2-210.3 0C14.3 128 0 113.7 0 96S14.3 64 32 64l96 0 0-32c0-17.7 14.3-32 32-32z"/>'},moon:{category:"ui",viewBox:"0 0 512 512",svg:'<path opacity=".4" fill="currentColor" d="M256 0C114.6 0 0 114.6 0 256S114.6 512 256 512c68.8 0 131.3-27.2 177.3-71.4 7.3-7 9.4-17.9 5.3-27.1s-13.7-14.9-23.8-14.1c-4.9 .4-9.8 .6-14.8 .6-101.6 0-184-82.4-184-184 0-72.1 41.5-134.6 102.1-164.8 9.1-4.5 14.3-14.3 13.1-24.4S322.6 8.5 312.7 6.3C294.4 2.2 275.4 0 256 0z"/><path fill="currentColor" d=""/>'},sun:{category:"ui",viewBox:"0 0 512 512",svg:'<path opacity=".4" fill="currentColor" d="M0 256c0-13.3 10.7-24 24-24l56 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-56 0c-13.3 0-24-10.7-24-24zM75 75c9.4-9.4 24.6-9.4 33.9 0l39.6 39.6c9.4 9.4 9.4 24.6 0 33.9s-24.6 9.4-33.9 0L75 108.9c-9.4-9.4-9.4-24.6 0-33.9zm0 328.1l39.6-39.6c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9L108.9 437c-9.4 9.4-24.6 9.4-33.9 0s-9.4-24.6 0-33.9zM232 24c0-13.3 10.7-24 24-24s24 10.7 24 24l0 56c0 13.3-10.7 24-24 24s-24-10.7-24-24l0-56zm0 408c0-13.3 10.7-24 24-24s24 10.7 24 24l0 56c0 13.3-10.7 24-24 24s-24-10.7-24-24l0-56zM363.5 114.6L403.1 75c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9l-39.6 39.6c-9.4 9.4-24.6 9.4-33.9 0s-9.4-24.6 0-33.9zm0 248.9c9.4-9.4 24.6-9.4 33.9 0L437 403.1c9.4 9.4 9.4 24.6 0 33.9s-24.6 9.4-33.9 0l-39.6-39.6c-9.4-9.4-9.4-24.6 0-33.9zM408 256c0-13.3 10.7-24 24-24l56 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-56 0c-13.3 0-24-10.7-24-24z"/><path fill="currentColor" d="M144 256a112 112 0 1 1 224 0 112 112 0 1 1 -224 0z"/>'},user:{category:"ui",viewBox:"0 0 448 512",svg:'<path fill="currentColor" d="M224 248a120 120 0 1 0 0-240 120 120 0 1 0 0 240zm-29.7 56C95.8 304 16 383.8 16 482.3 16 498.7 29.3 512 45.7 512l356.6 0c16.4 0 29.7-13.3 29.7-29.7 0-98.5-79.8-178.3-178.3-178.3l-59.4 0z"/>'}};var n={...l,...a},c={chevron:["chevron-down"],ui:["flag","language","moon","sun","user"]};var g={xs:"0.75rem",sm:"1rem",md:"1.25rem",lg:"1.5rem",xl:"2rem",xxl:"2.5rem"};function z(e){let o=typeof e=="string"?{name:e}:e,t=null;if(o.name&&o.name in n?t=n[o.name]:o.svg&&(t={viewBox:o.viewBox||"0 0 24 24",svg:o.svg}),!t)return o.name?console.warn(`Icon "${o.name}" not found in catalog`):console.warn("Icon configuration is invalid"),null;let r=o.size,i=typeof r=="number"?`${r}px`:g[r||"md"],s={width:i,height:i,display:"inline-block",verticalAlign:"middle",lineHeight:"1",flexShrink:"0"};return o.color&&(s.color=o.color),jsx("svg",{style:s,viewBox:t.viewBox,fill:"currentColor",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",dangerouslySetInnerHTML:{__html:t.svg}})}function B(e){return e in n}function N(){return Object.keys(n)}function k(e){return c[e]||[]}function M(){return Object.keys(c)}
2
+ export{z as Icon,M as getIconCategories,N as getIconNames,k as getIconsByCategory,n as iconCatalog,B as iconExists,g as sizeMap};//# sourceMappingURL=index.js.map
3
3
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/kit/categories/chevron.ts","../src/kit/categories/index.ts","../src/kit/icon.tsx"],"names":["chevronIcons","iconCatalog","iconsByCategory","sizeMap","Icon","props","cfg","iconData","sizeValue","size","style","jsx","iconExists","name","getIconNames","getIconsByCategory","category","getIconCategories"],"mappings":"0CAAO,IAAMA,CAAAA,CAAe,CAC1B,cAAA,CAAgB,CACd,SAAU,SAAA,CACV,OAAA,CAAS,YACT,GAAA,CAAK,8GACP,CACF,CAAA,CCJO,IAAMC,EAAc,CACzB,GAAGD,CACL,CAAA,CAIaE,CAAAA,CAAkB,CAC7B,OAAA,CAAW,CAAC,cAAc,CAC5B,MCQiBC,CAAAA,CAAkC,CAC3C,GAAU,SAAA,CACV,EAAA,CAAU,OACV,EAAA,CAAU,SAAA,CACV,GAAU,QAAA,CACV,EAAA,CAAU,OACV,GAAA,CAAU,QACd,EAgBO,SAASC,CAAAA,CAAKC,CAAAA,CAAsC,CAWvD,IAAMC,CAAAA,CADS,OAAOD,CAAAA,EAAU,QAAA,CAAW,CAAE,IAAA,CAAMA,CAAM,EAAIA,CAAAA,CAGzDE,CAAAA,CAAoD,KAWxD,GATID,CAAAA,CAAI,MAAQA,CAAAA,CAAI,IAAA,IAAQL,EACxBM,CAAAA,CAAWN,CAAAA,CAAYK,CAAAA,CAAI,IAAgB,CAAA,CACpCA,CAAAA,CAAI,MACXC,CAAAA,CAAW,CACP,QAAUD,CAAAA,CAAI,OAAA,EAAW,YACzB,GAAA,CAAUA,CAAAA,CAAI,GAClB,CAAA,CAAA,CAGA,CAACC,EACD,OAAID,CAAAA,CAAI,KACJ,OAAA,CAAQ,IAAA,CAAK,SAASA,CAAAA,CAAI,IAAI,CAAA,sBAAA,CAAwB,CAAA,CAEtD,OAAA,CAAQ,IAAA,CAAK,+BAA+B,CAAA,CAEzC,IAAA,CAGX,IAAME,CAAAA,CAAYF,CAAAA,CAAI,KAEhBG,CAAAA,CAAO,OAAOD,GAAc,QAAA,CAC5B,CAAA,EAAGA,CAAS,CAAA,EAAA,CAAA,CACZL,CAAAA,CAAQK,GAAa,IAAI,CAAA,CAEzBE,EAAgC,CAClC,KAAA,CAA0BD,CAAAA,CAC1B,MAAA,CAA0BA,CAAAA,CAC1B,OAAA,CAA0B,eAC1B,aAAA,CAA0B,QAAA,CAC1B,WAA0B,GAAA,CAC1B,UAAA,CAA0B,GAC9B,CAAA,CAEA,OAAIH,EAAI,KAAA,GAAOI,CAAAA,CAAM,MAAQJ,CAAAA,CAAI,KAAA,CAAA,CAG7BK,IAAC,KAAA,CAAA,CACG,KAAA,CAAuBD,EACvB,OAAA,CAAuBH,CAAAA,CAAS,OAAA,CAChC,IAAA,CAAsB,cAAA,CACtB,KAAA,CAAsB,6BACtB,aAAA,CAAsB,MAAA,CACtB,KAAsB,KAAA,CACtB,uBAAA,CAA2B,CACvB,MAAA,CAAkBA,CAAAA,CAAS,GAC/B,CAAA,CACJ,CAER,CAKO,SAASK,CAAAA,CAAWC,EAAgC,CACvD,OAAOA,KAAQZ,CACnB,CAKO,SAASa,CAAAA,EAA2B,CACvC,OAAO,OAAO,IAAA,CAAKb,CAAW,CAClC,CAKO,SAASc,EAAmBC,CAAAA,CAA8B,CAC7D,OAAQd,CAAAA,CAAgBc,CAAwC,GAAK,EACzE,CAKO,SAASC,CAAAA,EAA8B,CAC1C,OAAO,MAAA,CAAO,IAAA,CAAKf,CAAe,CACtC","file":"index.js","sourcesContent":["export const chevronIcons = {\n 'chevron-down': {\n category: 'chevron',\n viewBox: '0 0 24 24',\n svg: `<path d=\"M6 9L12 15L18 9\" stroke=\"#000000\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>`,\n },\n} as const;\n\nexport type ChevronIconName = keyof typeof chevronIcons;\n","import { chevronIcons } from './chevron';\n\nexport const iconCatalog = {\n ...chevronIcons,\n} as const;\n\nexport type IconName = keyof typeof iconCatalog;\n\nexport const iconsByCategory = {\n 'chevron': ['chevron-down'],\n} as const;\n","// src/kit/icon.tsx\r\n//\r\n// Made with ❤️ by Maysara.\r\n\r\n\r\n\r\n// ╔════════════════════════════════════════ PACK ════════════════════════════════════════╗\r\n\r\n import { JSXElement } from '@minejs/jsx';\r\n import { IconProps, iconCatalog, type IconName } from '../types';\r\n import { iconsByCategory } from './categories';\r\n\r\n// ╚══════════════════════════════════════════════════════════════════════════════════════╝\r\n\r\n\r\n\r\n// ╔════════════════════════════════════════ INIT ════════════════════════════════════════╗\r\n\r\n export const sizeMap: Record<string, string> = {\r\n xs : '0.75rem',\r\n sm : '1rem',\r\n md : '1.25rem',\r\n lg : '1.5rem',\r\n xl : '2rem',\r\n 'xxl' : '2.5rem'\r\n };\r\n\r\n// ╚══════════════════════════════════════════════════════════════════════════════════════╝\r\n\r\n\r\n\r\n// ╔════════════════════════════════════════ CORE ════════════════════════════════════════╗\r\n\r\n /**\r\n * Icon Component\r\n * Renders inline SVG icons with various options\r\n *\r\n * @example\r\n * Icon('check')\r\n * Icon({ name: 'spinner', spin: true, size: 'lg' })\r\n */\r\n export function Icon(props: IconProps) : JSXElement | null {\r\n\r\n interface IconLikeConfig {\r\n name? : string\r\n size? : number | string\r\n color? : string\r\n svg? : string\r\n viewBox? : string\r\n }\r\n\r\n const config = typeof props === 'string' ? { name: props } : props;\r\n const cfg = config as IconLikeConfig;\r\n\r\n let iconData: { viewBox: string; svg: string } | null = null;\r\n\r\n if (cfg.name && cfg.name in iconCatalog) {\r\n iconData = iconCatalog[cfg.name as IconName] as { viewBox: string; svg: string };\r\n } else if (cfg.svg) {\r\n iconData = {\r\n viewBox : cfg.viewBox || '0 0 24 24',\r\n svg : cfg.svg\r\n };\r\n }\r\n\r\n if (!iconData) {\r\n if (cfg.name) {\r\n console.warn(`Icon \"${cfg.name}\" not found in catalog`);\r\n } else {\r\n console.warn('Icon configuration is invalid');\r\n }\r\n return null;\r\n }\r\n\r\n const sizeValue = cfg.size;\r\n\r\n const size = typeof sizeValue === 'number'\r\n ? `${sizeValue}px`\r\n : sizeMap[sizeValue || 'md'];\r\n\r\n const style: Record<string, string> = {\r\n width : size,\r\n height : size,\r\n display : 'inline-block',\r\n verticalAlign : 'middle',\r\n lineHeight : '1',\r\n flexShrink : '0'\r\n };\r\n\r\n if (cfg.color) style.color = cfg.color;\r\n\r\n return (\r\n <svg\r\n style = {style}\r\n viewBox = {iconData.viewBox}\r\n fill = \"currentColor\"\r\n xmlns = \"http://www.w3.org/2000/svg\"\r\n aria-hidden = \"true\"\r\n role = \"img\"\r\n dangerouslySetInnerHTML = {{\r\n __html : iconData.svg\r\n }}\r\n />\r\n );\r\n }\r\n\r\n /**\r\n * Utility function to check if an icon exists\r\n */\r\n export function iconExists(name: string): name is IconName {\r\n return name in iconCatalog;\r\n }\r\n\r\n /**\r\n * Get all available icon names\r\n */\r\n export function getIconNames(): IconName[] {\r\n return Object.keys(iconCatalog) as IconName[];\r\n }\r\n\r\n /**\r\n * Get icons by category\r\n */\r\n export function getIconsByCategory(category: string): IconName[] {\r\n return (iconsByCategory[category as keyof typeof iconsByCategory] || []) as unknown as IconName[];\r\n }\r\n\r\n /**\r\n * Get all available categories\r\n */\r\n export function getIconCategories(): string[] {\r\n return Object.keys(iconsByCategory);\r\n }\r\n\r\n// ╚══════════════════════════════════════════════════════════════════════════════════════╝\r\n"]}
1
+ {"version":3,"sources":["../src/kit/categories/chevron.ts","../src/kit/categories/ui.ts","../src/kit/categories/index.ts","../src/kit/icon.tsx"],"names":["chevronIcons","uiIcons","iconCatalog","iconsByCategory","sizeMap","Icon","props","cfg","iconData","sizeValue","size","style","jsx","iconExists","name","getIconNames","getIconsByCategory","category","getIconCategories"],"mappings":"0CAAO,IAAMA,CAAAA,CAAe,CAC1B,cAAA,CAAgB,CACd,QAAA,CAAU,SAAA,CACV,OAAA,CAAS,WAAA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AClC,CAKO,SAASc,CAAAA,CAAmBC,CAAAA,CAA8B,CAC7D,OAAQd,CAAAA,CAAgBc,CAAwC,CAAA,EAAK,EACzE,CAKO,SAASC,CAAAA,EAA8B,CAC1C,OAAO,MAAA,CAAO,IAAA,CAAKf,CAAe,CACtC","file":"index.js","sourcesContent":["export const chevronIcons = {\n 'chevron-down': {\n category: 'chevron',\n viewBox: '0 0 24 24',\n svg: `<path d=\"M6 9L12 15L18 9\" stroke=\"#000000\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>`,\n },\n} as const;\n\nexport type ChevronIconName = keyof typeof chevronIcons;\n","export const uiIcons = {\n 'flag': {\n category: 'ui',\n viewBox: '0 0 448 512',\n svg: `<path opacity=\".4\" fill=\"currentColor\" d=\"M64 48l69-17.2c38.1-9.5 78.3-5.1 113.5 12.5 46.3 23.2 100.8 23.2 147.1 0l9.6-4.8C423.8 28.1 448 43.1 448 66.1l0 247.7c0 13.3-8.3 25.3-20.8 30l-34.7 13c-46.2 17.3-97.6 14.6-141.7-7.4-37.9-19-81.4-23.7-122.5-13.4L64 352 64 48z\"/><path fill=\"currentColor\" d=\"M32 0C49.7 0 64 14.3 64 32l0 448c0 17.7-14.3 32-32 32S0 497.7 0 480L0 32C0 14.3 14.3 0 32 0z\"/>`,\n },\n 'language': {\n category: 'ui',\n viewBox: '0 0 576 512',\n svg: `<path opacity=\".4\" fill=\"currentColor\" d=\"M258.8 467c58.2-131 80.2-180.5 128-288 5.1-11.6 16.6-19 29.2-19s24.1 7.4 29.2 19l128 288c7.2 16.2-.1 35.1-16.2 42.2s-35.1-.1-42.2-16.2l-20-45-157.5 0-20 45c-7.2 16.2-26.1 23.4-42.2 16.2s-23.4-26.1-16.2-42.2zm106.9-83L466.3 384 416 270.8 365.7 384z\"/><path fill=\"currentColor\" d=\"M160 0c17.7 0 32 14.3 32 32l0 32 128 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-9.6 0-8.4 23.1c-16.4 45.2-41.1 86.5-72.2 122 14.2 8.8 29 16.6 44.4 23.5l50.4 22.4-26 58.5-50.4-22.4c-23-10.2-45-22.4-65.8-36.4-21.3 17.2-44.6 32.2-69.5 44.7L78.3 380.6c-15.8 7.9-35 1.5-42.9-14.3s-1.5-35 14.3-42.9l34.5-17.3c16.3-8.2 31.8-17.7 46.4-28.3-13.8-12.7-26.8-26.4-38.9-40.9L71.4 212.5c-11.3-13.6-9.5-33.8 4.1-45.1s33.8-9.5 45.1 4.1l20.3 24.4c11.5 13.9 24.1 26.8 37.4 38.7 27.5-30.4 49.2-66.1 63.5-105.4l.5-1.2-210.3 0C14.3 128 0 113.7 0 96S14.3 64 32 64l96 0 0-32c0-17.7 14.3-32 32-32z\"/>`,\n },\n 'moon': {\n category: 'ui',\n viewBox: '0 0 512 512',\n svg: `<path opacity=\".4\" fill=\"currentColor\" d=\"M256 0C114.6 0 0 114.6 0 256S114.6 512 256 512c68.8 0 131.3-27.2 177.3-71.4 7.3-7 9.4-17.9 5.3-27.1s-13.7-14.9-23.8-14.1c-4.9 .4-9.8 .6-14.8 .6-101.6 0-184-82.4-184-184 0-72.1 41.5-134.6 102.1-164.8 9.1-4.5 14.3-14.3 13.1-24.4S322.6 8.5 312.7 6.3C294.4 2.2 275.4 0 256 0z\"/><path fill=\"currentColor\" d=\"\"/>`,\n },\n 'sun': {\n category: 'ui',\n viewBox: '0 0 512 512',\n svg: `<path opacity=\".4\" fill=\"currentColor\" d=\"M0 256c0-13.3 10.7-24 24-24l56 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-56 0c-13.3 0-24-10.7-24-24zM75 75c9.4-9.4 24.6-9.4 33.9 0l39.6 39.6c9.4 9.4 9.4 24.6 0 33.9s-24.6 9.4-33.9 0L75 108.9c-9.4-9.4-9.4-24.6 0-33.9zm0 328.1l39.6-39.6c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9L108.9 437c-9.4 9.4-24.6 9.4-33.9 0s-9.4-24.6 0-33.9zM232 24c0-13.3 10.7-24 24-24s24 10.7 24 24l0 56c0 13.3-10.7 24-24 24s-24-10.7-24-24l0-56zm0 408c0-13.3 10.7-24 24-24s24 10.7 24 24l0 56c0 13.3-10.7 24-24 24s-24-10.7-24-24l0-56zM363.5 114.6L403.1 75c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9l-39.6 39.6c-9.4 9.4-24.6 9.4-33.9 0s-9.4-24.6 0-33.9zm0 248.9c9.4-9.4 24.6-9.4 33.9 0L437 403.1c9.4 9.4 9.4 24.6 0 33.9s-24.6 9.4-33.9 0l-39.6-39.6c-9.4-9.4-9.4-24.6 0-33.9zM408 256c0-13.3 10.7-24 24-24l56 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-56 0c-13.3 0-24-10.7-24-24z\"/><path fill=\"currentColor\" d=\"M144 256a112 112 0 1 1 224 0 112 112 0 1 1 -224 0z\"/>`,\n },\n 'user': {\n category: 'ui',\n viewBox: '0 0 448 512',\n svg: `<path fill=\"currentColor\" d=\"M224 248a120 120 0 1 0 0-240 120 120 0 1 0 0 240zm-29.7 56C95.8 304 16 383.8 16 482.3 16 498.7 29.3 512 45.7 512l356.6 0c16.4 0 29.7-13.3 29.7-29.7 0-98.5-79.8-178.3-178.3-178.3l-59.4 0z\"/>`,\n },\n} as const;\n\nexport type UiIconName = keyof typeof uiIcons;\n","import { chevronIcons } from './chevron';\nimport { uiIcons } from './ui';\n\nexport const iconCatalog = {\n ...chevronIcons,\n ...uiIcons,\n} as const;\n\nexport type IconName = keyof typeof iconCatalog;\n\nexport const iconsByCategory = {\n 'chevron': ['chevron-down'],\n 'ui': ['flag', 'language', 'moon', 'sun', 'user'],\n} as const;\n","// src/kit/icon.tsx\r\n//\r\n// Made with ❤️ by Maysara.\r\n\r\n\r\n\r\n// ╔════════════════════════════════════════ PACK ════════════════════════════════════════╗\r\n\r\n import { JSXElement } from '@minejs/jsx';\r\n import { IconProps, iconCatalog, type IconName } from '../types';\r\n import { iconsByCategory } from './categories';\r\n\r\n// ╚══════════════════════════════════════════════════════════════════════════════════════╝\r\n\r\n\r\n\r\n// ╔════════════════════════════════════════ INIT ════════════════════════════════════════╗\r\n\r\n export const sizeMap: Record<string, string> = {\r\n xs : '0.75rem',\r\n sm : '1rem',\r\n md : '1.25rem',\r\n lg : '1.5rem',\r\n xl : '2rem',\r\n 'xxl' : '2.5rem'\r\n };\r\n\r\n// ╚══════════════════════════════════════════════════════════════════════════════════════╝\r\n\r\n\r\n\r\n// ╔════════════════════════════════════════ CORE ════════════════════════════════════════╗\r\n\r\n /**\r\n * Icon Component\r\n * Renders inline SVG icons with various options\r\n *\r\n * @example\r\n * Icon('check')\r\n * Icon({ name: 'spinner', spin: true, size: 'lg' })\r\n */\r\n export function Icon(props: IconProps) : JSXElement | null {\r\n\r\n interface IconLikeConfig {\r\n name? : string\r\n size? : number | string\r\n color? : string\r\n svg? : string\r\n viewBox? : string\r\n }\r\n\r\n const config = typeof props === 'string' ? { name: props } : props;\r\n const cfg = config as IconLikeConfig;\r\n\r\n let iconData: { viewBox: string; svg: string } | null = null;\r\n\r\n if (cfg.name && cfg.name in iconCatalog) {\r\n iconData = iconCatalog[cfg.name as IconName] as { viewBox: string; svg: string };\r\n } else if (cfg.svg) {\r\n iconData = {\r\n viewBox : cfg.viewBox || '0 0 24 24',\r\n svg : cfg.svg\r\n };\r\n }\r\n\r\n if (!iconData) {\r\n if (cfg.name) {\r\n console.warn(`Icon \"${cfg.name}\" not found in catalog`);\r\n } else {\r\n console.warn('Icon configuration is invalid');\r\n }\r\n return null;\r\n }\r\n\r\n const sizeValue = cfg.size;\r\n\r\n const size = typeof sizeValue === 'number'\r\n ? `${sizeValue}px`\r\n : sizeMap[sizeValue || 'md'];\r\n\r\n const style: Record<string, string> = {\r\n width : size,\r\n height : size,\r\n display : 'inline-block',\r\n verticalAlign : 'middle',\r\n lineHeight : '1',\r\n flexShrink : '0'\r\n };\r\n\r\n if (cfg.color) style.color = cfg.color;\r\n\r\n return (\r\n <svg\r\n style = {style}\r\n viewBox = {iconData.viewBox}\r\n fill = \"currentColor\"\r\n xmlns = \"http://www.w3.org/2000/svg\"\r\n aria-hidden = \"true\"\r\n role = \"img\"\r\n dangerouslySetInnerHTML = {{\r\n __html : iconData.svg\r\n }}\r\n />\r\n );\r\n }\r\n\r\n /**\r\n * Utility function to check if an icon exists\r\n */\r\n export function iconExists(name: string): name is IconName {\r\n return name in iconCatalog;\r\n }\r\n\r\n /**\r\n * Get all available icon names\r\n */\r\n export function getIconNames(): IconName[] {\r\n return Object.keys(iconCatalog) as IconName[];\r\n }\r\n\r\n /**\r\n * Get icons by category\r\n */\r\n export function getIconsByCategory(category: string): IconName[] {\r\n return (iconsByCategory[category as keyof typeof iconsByCategory] || []) as unknown as IconName[];\r\n }\r\n\r\n /**\r\n * Get all available categories\r\n */\r\n export function getIconCategories(): string[] {\r\n return Object.keys(iconsByCategory);\r\n }\r\n\r\n// ╚══════════════════════════════════════════════════════════════════════════════════════╝\r\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cruxkit/icon",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "description": "A lightweight, type-safe icon library offering full TypeScript support and effortless customization.",
5
5
  "keywords": ["crux", "kit", "icon"],
6
6
  "license": "MIT",
@@ -46,10 +46,12 @@
46
46
  "@eslint/js": "^9.39.2",
47
47
  "@stylistic/eslint-plugin": "^5.6.1",
48
48
  "@types/bun": "^1.3.5",
49
+ "@types/jsdom": "^27.0.0",
49
50
  "@types/node": "^20.19.27",
50
51
  "@types/react": "^19.2.8",
51
52
  "bun-plugin-dts": "^0.3.0",
52
53
  "bun-types": "^1.3.5",
54
+ "jsdom": "^27.4.0",
53
55
  "ts-node": "^10.9.2",
54
56
  "tsup": "^8.5.1",
55
57
  "typescript": "^5.9.3",