mirror of
				https://github.com/slint-ui/slint.git
				synced 2025-10-31 03:54:25 +00:00 
			
		
		
		
	figma-inspector: added stricter types
This commit is contained in:
		
							parent
							
								
									7e5249889f
								
							
						
					
					
						commit
						ee17d562f7
					
				
					 1 changed files with 21 additions and 32 deletions
				
			
		|  | @ -543,7 +543,7 @@ interface PropertyInstance { | ||||||
| function generateStructsAndInstances( | function generateStructsAndInstances( | ||||||
|     variableTree: VariableNode, |     variableTree: VariableNode, | ||||||
|     collectionName: string, |     collectionName: string, | ||||||
|     collectionData: any, // Using any for now, but ideally define a proper interface
 |     collectionData: CollectionData, // using strict type interface
 | ||||||
| ): { | ): { | ||||||
|     structs: string; |     structs: string; | ||||||
|     instances: string; |     instances: string; | ||||||
|  | @ -1069,6 +1069,19 @@ function generateStructsAndInstances( | ||||||
|         instances: instancesCode, |         instances: instancesCode, | ||||||
|     }; |     }; | ||||||
| } | } | ||||||
|  | interface VariableModeData { | ||||||
|  |     value: string; | ||||||
|  |     type: string; | ||||||
|  |     refId?: string; | ||||||
|  |     comment?: string; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | interface CollectionData { | ||||||
|  |     name: string; | ||||||
|  |     formattedName: string; | ||||||
|  |     modes: Set<string>; | ||||||
|  |     variables: Map<string, Map<string, VariableModeData>>; | ||||||
|  | } | ||||||
| 
 | 
 | ||||||
| // For Figma Plugin - Export function with hierarchical structure
 | // For Figma Plugin - Export function with hierarchical structure
 | ||||||
| // Export each collection to a separate virtual file
 | // Export each collection to a separate virtual file
 | ||||||
|  | @ -1093,26 +1106,7 @@ export async function exportFigmaVariablesToSeparateFiles( | ||||||
|         const exportedFiles: Array<{ name: string; content: string }> = []; |         const exportedFiles: Array<{ name: string; content: string }> = []; | ||||||
| 
 | 
 | ||||||
|         // First, initialize the collection structure for ALL collections
 |         // First, initialize the collection structure for ALL collections
 | ||||||
|         const collectionStructure = new Map< |         const collectionStructure = new Map<string, CollectionData>(); | ||||||
|             string, |  | ||||||
|             { |  | ||||||
|                 name: string; |  | ||||||
|                 formattedName: string; |  | ||||||
|                 modes: Set<string>; |  | ||||||
|                 variables: Map< |  | ||||||
|                     string, |  | ||||||
|                     Map< |  | ||||||
|                         string, |  | ||||||
|                         { |  | ||||||
|                             value: string; |  | ||||||
|                             type: string; |  | ||||||
|                             refId?: string; |  | ||||||
|                             comment?: string; |  | ||||||
|                         } |  | ||||||
|                     > |  | ||||||
|                 >; |  | ||||||
|             } |  | ||||||
|         >(); |  | ||||||
| 
 | 
 | ||||||
|         // Build a global map of variable paths
 |         // Build a global map of variable paths
 | ||||||
|         const variablePathsById = new Map< |         const variablePathsById = new Map< | ||||||
|  | @ -1193,16 +1187,11 @@ export async function exportFigmaVariablesToSeparateFiles( | ||||||
|                             .get(collectionName)! |                             .get(collectionName)! | ||||||
|                             .variables.has(sanitizedRowName) |                             .variables.has(sanitizedRowName) | ||||||
|                     ) { |                     ) { | ||||||
|                         collectionStructure.get(collectionName)!.variables.set( |                         collectionStructure | ||||||
|  |                             .get(collectionName)! | ||||||
|  |                             .variables.set( | ||||||
|                                 sanitizedRowName, |                                 sanitizedRowName, | ||||||
|                             new Map< |                                 new Map<string, VariableModeData>(), | ||||||
|                                 string, |  | ||||||
|                                 { |  | ||||||
|                                     value: string; |  | ||||||
|                                     type: string; |  | ||||||
|                                     refId?: string; |  | ||||||
|                                 } |  | ||||||
|                             >(), |  | ||||||
|                             ); |                             ); | ||||||
|                     } |                     } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 szecket
						szecket