/** * Content Extractor * * Extracts text content and information architecture from Figma designs. * Organizes content by frame/page hierarchy and identifies semantic roles. */ import type { FigmaNode } from '../types.js'; /** * Semantic roles for text content */ export type SemanticRole = 'heading' | 'subheading' | 'body' | 'button' | 'label' | 'link' | 'caption' | 'placeholder' | 'navigation' | 'footer' | 'cta' | 'title' | 'description' | 'unknown'; /** * Extracted text item with metadata */ export interface ExtractedText { /** Unique identifier for the text node */ id: string; /** The text content */ text: string; /** Detected semantic role */ role: SemanticRole; /** Node name from Figma */ nodeName: string; /** Frame path (e.g., "Home / Hero / Title") */ framePath: string[]; /** Typography style info */ style?: { fontFamily?: string; fontSize?: number; fontWeight?: number; lineHeight?: number; letterSpacing?: number; textAlign?: string; }; /** Bounding box dimensions */ bounds?: { width: number; height: number; x: number; y: number; }; /** Parent frame info */ parentFrame?: { id: string; name: string; type: string; }; } /** * Content structure for a frame/section */ export interface ContentSection { /** Section identifier */ id: string; /** Section name */ name: string; /** Frame type */ type: string; /** Child sections */ children: ContentSection[]; /** Text items in this section */ textItems: ExtractedText[]; /** Semantic groupings (e.g., hero, features, navigation) */ semanticGroup?: string; } /** * Page content structure */ export interface PageContent { /** Page name */ name: string; /** Page identifier */ id: string; /** Top-level sections */ sections: ContentSection[]; /** All text items flattened */ allText: ExtractedText[]; /** Navigation items detected */ navigation: { primary: string[]; secondary: string[]; footer: string[]; }; } /** * Full extracted content from a Figma file */ export interface ExtractedContent { /** File name */ fileName: string; /** Extracted pages */ pages: Record; /** Content organized by semantic role */ byRole: Record; /** Navigation structure */ navigation: { primary: string[]; footer: string[]; }; /** Summary statistics */ stats: { totalTextItems: number; totalPages: number; totalSections: number; roleBreakdown: Record; }; } /** * Extract all content from Figma nodes */ export declare function extractContent(nodes: FigmaNode[], fileName: string): ExtractedContent; /** * Format extracted content as JSON for output */ export declare function formatContentAsJson(content: ExtractedContent): string; /** * Format extracted content as Markdown */ export declare function formatContentAsMarkdown(content: ExtractedContent): string; //# sourceMappingURL=content-extractor.d.ts.map