1+ import * as lucide from 'lucide'
12import type { IconNormalized } from './index'
23
34export function getLucideIcons ( ) : IconNormalized [ ] {
4- // Importamos o mapa de ícones
5- const lucide = require ( 'lucide' )
6-
7- // O Lucide exporta um objeto 'icons'. Cada ícone nele é um array:
5+ // Lucide exports an 'icons' object. Each icon is an array:
86 // [ ['path', { d: '...' }], ['circle', { ... }] ]
9- const iconsMap = lucide . icons
7+ const iconsMap = ( lucide as any ) . icons || lucide
108
119 if ( ! iconsMap ) {
12- throw new Error ( 'Não foi possível carregar os ícones do Lucide. Verifique se o pacote "lucide" está instalado .' )
10+ throw new Error ( 'Could not load Lucide icons. Please ensure the "lucide" package is installed .' )
1311 }
1412
1513 return Object . entries ( iconsMap ) . map ( ( [ name , icon ] : [ string , any ] ) => {
16- // No Lucide puro, o 'icon' em si já é o array de elementos (children)
17- // Se estiver usando lucide-vue, a estrutura pode variar, mas no core JS é um array .
18- const nodes = Array . isArray ( icon ) ? icon : ( icon . children || [ ] )
14+ // In pure Lucide, the 'icon' itself is the array of elements (children).
15+ // If using lucide-vue or other wrappers, the structure might vary, so we fallback to .children .
16+ const nodes = Array . isArray ( icon ) ? icon : ( icon ? .children || [ ] )
1917
2018 const contents = nodes
2119 . map ( ( [ tagName , attrs ] : [ string , any ] ) => {
@@ -28,7 +26,7 @@ export function getLucideIcons(): IconNormalized[] {
2826
2927 return {
3028 name,
31- // Atributos padrão para SVGs do Lucide
29+ // Default SVG attributes for Lucide icons
3230 attrs : {
3331 xmlns : 'http://www.w3.org/2000/svg' ,
3432 width : 24 ,
0 commit comments