@@ -543,7 +543,7 @@ interface PropertyInstance {
543
543
function generateStructsAndInstances (
544
544
variableTree : VariableNode ,
545
545
collectionName : string ,
546
- collectionData : any , // Using any for now, but ideally define a proper interface
546
+ collectionData : CollectionData , // using strict type interface
547
547
) : {
548
548
structs : string ;
549
549
instances : string ;
@@ -1069,6 +1069,20 @@ function generateStructsAndInstances(
1069
1069
instances : instancesCode ,
1070
1070
} ;
1071
1071
}
1072
+ interface VariableModeData {
1073
+ value : string ;
1074
+ type : string ; // 'COLOR', 'FLOAT', 'STRING', 'BOOLEAN'
1075
+ refId ?: string ;
1076
+ comment ?: string ;
1077
+ }
1078
+
1079
+ interface CollectionData {
1080
+ name : string ; // Original collection name
1081
+ formattedName : string ; // Sanitized name for Slint globals/structs
1082
+ modes : Set < string > ; // Sanitized mode names
1083
+ variables : Map < string , Map < string , VariableModeData > > ; // Map<rowName, Map<modeName, data>>
1084
+ // Add other properties if collectionData holds more info
1085
+ }
1072
1086
1073
1087
// For Figma Plugin - Export function with hierarchical structure
1074
1088
// Export each collection to a separate virtual file
@@ -1093,26 +1107,7 @@ export async function exportFigmaVariablesToSeparateFiles(
1093
1107
const exportedFiles : Array < { name : string ; content : string } > = [ ] ;
1094
1108
1095
1109
// First, initialize the collection structure for ALL collections
1096
- const collectionStructure = new Map <
1097
- string ,
1098
- {
1099
- name : string ;
1100
- formattedName : string ;
1101
- modes : Set < string > ;
1102
- variables : Map <
1103
- string ,
1104
- Map <
1105
- string ,
1106
- {
1107
- value : string ;
1108
- type : string ;
1109
- refId ?: string ;
1110
- comment ?: string ;
1111
- }
1112
- >
1113
- > ;
1114
- }
1115
- > ( ) ;
1110
+ const collectionStructure = new Map < string , CollectionData > ( ) ;
1116
1111
1117
1112
// Build a global map of variable paths
1118
1113
const variablePathsById = new Map <
@@ -1193,17 +1188,12 @@ export async function exportFigmaVariablesToSeparateFiles(
1193
1188
. get ( collectionName ) !
1194
1189
. variables . has ( sanitizedRowName )
1195
1190
) {
1196
- collectionStructure . get ( collectionName ) ! . variables . set (
1197
- sanitizedRowName ,
1198
- new Map <
1199
- string ,
1200
- {
1201
- value : string ;
1202
- type : string ;
1203
- refId ?: string ;
1204
- }
1205
- > ( ) ,
1206
- ) ;
1191
+ collectionStructure
1192
+ . get ( collectionName ) !
1193
+ . variables . set (
1194
+ sanitizedRowName ,
1195
+ new Map < string , VariableModeData > ( ) ,
1196
+ ) ;
1207
1197
}
1208
1198
1209
1199
// Process values for each mode
0 commit comments