File tree Expand file tree Collapse file tree 2 files changed +14
-5
lines changed
packages/nimiq-css/src/unocss Expand file tree Collapse file tree 2 files changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -6,11 +6,11 @@ export interface NimiqIconsOptions {
66
77}
88
9- export function getNimiqIcons ( _options : NimiqIconsOptions ) : Rule < PresetWind3Theme > [ ] {
9+ export function getNimiqIcons ( _options : NimiqIconsOptions ) : { rules : Rule < PresetWind3Theme > [ ] , iconsNames : string [ ] } {
1010 const rules : Rule < PresetWind3Theme > [ ] = [
1111 [
1212 / ^ i - n i m i q : ( .* ) $ / ,
13- async ( [ , name ] ) => {
13+ async function * ( [ , name ] , { symbols } ) {
1414 const iconData = getIconData ( nimiqIconsJson , name )
1515 if ( ! iconData ) {
1616 console . warn ( `Icon "${ name } " not found in Nimiq icons` )
@@ -43,10 +43,18 @@ export function getNimiqIcons(_options: NimiqIconsOptions): Rule<PresetWind3Them
4343 'background-color' : 'transparent' ,
4444 }
4545 }
46- return cssObject
46+ yield {
47+ [ symbols . layer ] : 'icons' ,
48+ ...cssObject ,
49+ }
50+ } ,
51+ {
52+ layer : 'icons' ,
4753 } ,
4854 ] ,
4955 ]
5056
51- return rules
57+ const iconsNames = Object . keys ( nimiqIconsJson . icons ) . map ( name => `i-nimiq:${ name } ` )
58+
59+ return { rules, iconsNames }
5260}
Original file line number Diff line number Diff line change @@ -331,8 +331,9 @@ export const presetNimiq = definePreset((options: NimiqPresetOptions = {}) => {
331331 const { icons = true } = options
332332 if ( icons ) {
333333 const iconsOptions = typeof icons === 'object' ? icons : { }
334- const iconsRules = getNimiqIcons ( iconsOptions )
334+ const { rules : iconsRules , iconsNames } = getNimiqIcons ( iconsOptions )
335335 rules . push ( ...iconsRules )
336+ rulesNames . push ( ...iconsNames )
336337 }
337338
338339 // TODO Move to onmaxPreset
You can’t perform that action at this time.
0 commit comments