@@ -25,7 +25,7 @@ const extractVariable = (variable, value) => {
25
25
26
26
// this is being stored so we can properly update the design tokens later to account for all
27
27
// modes when using aliases
28
- aliasName : collection . name ,
28
+ aliasCollectionName : collection . name ,
29
29
aliasModes : collection . modes
30
30
}
31
31
}
@@ -71,19 +71,19 @@ const processAliasModes = (variables) => {
71
71
return collector
72
72
}
73
73
74
- const { aliasModes, aliasName } = variable
74
+ const { aliasModes, aliasCollectionName } = variable
75
75
76
76
// this was only added for this function to process that data so before we return the variables, we can remove it
77
77
delete variable . aliasModes
78
- delete variable . selfCollectionName
78
+ delete variable . aliasCollectionName
79
79
80
80
for ( let i = 0 ; i < aliasModes . length ; i ++ ) {
81
81
const modeBasedVariable = { ...variable }
82
82
const nameParts = modeBasedVariable . name . split ( '/' ) ;
83
83
84
84
nameParts . splice ( 1 , 0 , aliasModes [ i ] . name )
85
85
86
- modeBasedVariable . values = modeBasedVariable . values . replace ( `{${ aliasName } .` , `{${ aliasName } .${ aliasModes [ i ] . name } .` )
86
+ modeBasedVariable . values = modeBasedVariable . values . replace ( `{${ aliasCollectionName } .` , `{${ aliasCollectionName } .${ aliasModes [ i ] . name } .` )
87
87
modeBasedVariable . name = nameParts . join ( '/' )
88
88
89
89
collector . push ( modeBasedVariable )
@@ -97,7 +97,6 @@ export const getVariables = (figma: PluginAPI, settings: Settings) => {
97
97
const excludedCollectionIds = figma . variables . getLocalVariableCollections ( ) . filter ( collection => ! [ '.' , '_' , ...settings . exclusionPrefix . split ( ',' ) ] . includes ( collection . name . charAt ( 0 ) ) ) . map ( collection => collection . id ) ;
98
98
// get collections
99
99
const collections = Object . fromEntries ( figma . variables . getLocalVariableCollections ( ) . map ( ( collection ) => [ collection . id , collection ] ) )
100
-
101
100
// get variables
102
101
const variables = figma . variables . getLocalVariables ( ) . filter ( variable => excludedCollectionIds . includes ( variable . variableCollectionId ) ) . map ( ( variable ) => {
103
102
// get collection name and modes
@@ -125,6 +124,5 @@ export const getVariables = (figma: PluginAPI, settings: Settings) => {
125
124
}
126
125
} )
127
126
} )
128
-
129
127
return settings . modeReference ? processAliasModes ( variables . flat ( ) ) : variables . flat ( ) ;
130
128
}
0 commit comments