zp-figma-converter
Version:
Convert Figma designs to various code formats
99 lines • 2.73 kB
TypeScript
import { Converter } from '../../converters/converter.interface';
import { IntermediateNode } from '../../figma/intermediate';
/**
* Converter for intermediate nodes to CSD format
*/
export declare class CsdConverter implements Converter {
/**
* Main conversion method - converts intermediate node to CSD
* @param rootNode Root node from Figma
* @param outputPath Output file path for CSD
*/
convert(rootNode: IntermediateNode, outputPath: string): Promise<void>;
/**
* Get file extension for this converter
*/
getExtension(): string;
private adjustRootNodePosition;
/**
* Generate CSD structure and save to file
* @param rootNode Original root node
* @param csdContent Converted CSD content
* @param outputPath Output file path
*/
private generateAndSaveCsd;
/**
* Create JSON structure for CSD format
* @param rootNode Original root node
* @param csdContent Converted CSD content
* @returns JSON structure for CSD
*/
private createCsdJsonStructure;
/**
* Save JSON data to temporary file
* @param jsonData JSON data to save
* @returns Path to temporary file
*/
private saveTempJsonFile;
/**
* Convert intermediate node to CSD node
* @param node Intermediate node
* @returns CSD node
*/
private nodeToCsd;
/**
* Convert to ImageView node
*/
private convertToImageView;
/**
* Convert to Text node
*/
private convertToText;
/**
* Convert to Panel node
*/
private convertToPanel;
/**
* Convert to Sprite node
*/
private convertToSprite;
/**
* Convert to SingleNode
*/
private convertToSingleNode;
/**
* Add common properties to all node types
*/
private addCommonProperties;
/**
* Determine the anchor point based on the node type
*/
private getAnchorPoint;
/**
* Get Cocos CSD node type from intermediate node
*/
private getCocosCsdTypeFromNode;
/**
* Convert hex or rgba color string to RGB object
*/
private convertStringColorToRgb;
/**
* Create a hash code from a string
*/
private hashCode;
/**
* Process child nodes for a panel
* @param node Parent intermediate node
* @param panelNode Parent panel node
*/
private processChildNodes;
/**
* Calculate and adjust child node position relative to parent
*/
private adjustChildNodePosition;
/**
* Adjust the position of the child node based on the AnchorPoint of the parent node
*/
private adjustChildPositionBasedOnParentAnchor;
}
//# sourceMappingURL=csd-converter.d.ts.map