@@ -23,37 +23,34 @@ export function convertNodesWithConfig(nodes: IconNode[], options?: ProIconsOpti
2323 strokeCaps : [ "stroke-linejoin" ] ,
2424 strokeJoin : [ "stroke-linecap" ] ,
2525 cornerRadius : [ "rx" ] ,
26- strokeFilledElements : undefined ,
2726 }
2827
2928 if ( ! options ) return nodes
3029
3130 return nodes . map ( node => {
32- const children = node [ 2 ]
31+ const [ _ , props , children ] = node
3332
3433 for ( const [ optionK , svgAttrs ] of Object . entries ( attributeKey ) ) {
35- if ( svgAttrs ) {
36- for ( const s of svgAttrs ) {
37- if ( node [ 1 ] [ s ] && options [ optionK ] ) {
38- node [ 1 ] [ s ] = options [ optionK ]
39- }
34+ for ( const s of svgAttrs ) {
35+ if ( props [ s ] && options [ optionK ] ) {
36+ props [ s ] = options [ optionK ]
4037 }
4138 }
4239 }
4340
4441 // Outlining
4542 if (
46- ! Object . hasOwn ( node [ 1 ] , 'stroke-width' ) &&
47- Object . hasOwn ( node [ 1 ] , 'fill' ) &&
48- node [ 1 ] . fill != 'none' &&
49- node [ 1 ] . stroke != 'none' &&
50- node [ 1 ] [ 'stroke-width' ] !== '0' &&
43+ ! Object . hasOwn ( props , 'stroke-width' ) &&
44+ Object . hasOwn ( props , 'fill' ) &&
45+ props . fill != 'none' &&
46+ props . stroke != 'none' &&
47+ props [ 'stroke-width' ] !== '0' &&
5148 ( options ?. strokeWidth ?? 0 ) > defaultStroke
5249 ) {
53- node [ 1 ] [ 'stroke-width' ] = ( options . strokeWidth - defaultStroke ) . toString ( )
54- node [ 1 ] . stroke = node [ 1 ] . fill
55- node [ 1 ] [ 'stroke-linecap' ] = options . strokeCaps ?? 'round'
56- node [ 1 ] [ 'stroke-linejoin' ] = options . strokeJoin ?? 'round'
50+ props [ 'stroke-width' ] = ( options . strokeWidth - defaultStroke ) . toString ( )
51+ props . stroke = props . fill
52+ props [ 'stroke-linecap' ] = options . strokeCaps ?? 'round'
53+ props [ 'stroke-linejoin' ] = options . strokeJoin ?? 'round'
5754 }
5855
5956 if ( children . length ) {
@@ -65,16 +62,17 @@ export function convertNodesWithConfig(nodes: IconNode[], options?: ProIconsOpti
6562
6663export function renderNodeWithRoot ( nodes : IconNode [ ] , rootNode : IconNode , options : ProIconsOptions ) : string {
6764 const root = structuredClone ( rootNode )
68- root [ 2 ] . push ( ...nodes )
65+ const [ _ , props , children ] = root
66+ children . push ( ...nodes )
6967
7068 if ( options ?. size ) {
71- root [ 1 ] . width = options . size . toString ( )
72- root [ 1 ] . height = options . size . toString ( )
69+ props . width = options . size . toString ( )
70+ props . height = options . size . toString ( )
7371 }
7472
7573 if ( options ?. attributes ) {
7674 for ( const [ k , v ] of Object . entries ( options . attributes ) ) {
77- root [ 1 ] [ k ] = v
75+ props [ k ] = v
7876 }
7977 }
8078
0 commit comments