/** * Weavetab — tools/design_extract.ts * browser_extract_design: Extract design tokens, typography, color palette, * clean semantic HTML, and CSS from the current page into structured files * and a compact LLM design blueprint. * * Saves to configured designDir (e.g. ~/.weavetab/designs/ or custom workspace directory). * * Weavetab by fy2ne */ import CDP from "chrome-remote-interface"; import type { Config } from "../config/loader.js"; export interface ExtractDesignOptions { /** CSS selector of the container to extract (default: 'main', falls back to 'body') */ selector?: string; /** Format preset: 'tailwind' generates tailwind.theme.json, 'vanilla_css' generates scoped styles, 'tokens_only' extracts design tokens */ format?: "tailwind" | "vanilla_css" | "tokens_only"; /** Optional custom folder path to write extracted files into. If omitted, uses configured designDir */ outputDir?: string; /** Optional custom name for the design bundle folder (e.g. 'resend-hero') */ name?: string; /** Whether to capture SVG icons and image asset references (default: true) */ includeAssets?: boolean; /** If false, keeps Weavetab overlay visible during capture (default: true -> hidden) */ hideOverlay?: boolean; } export interface DesignTokens { meta: { url: string; title: string; extractedAt: string; selector: string; viewport: { width: number; height: number; }; isDarkMode: boolean; }; cssVariables: Record; palette: { backgrounds: string[]; text: string[]; borders: string[]; accents: string[]; }; typography: { fontFamilies: string[]; headings: Record; body: { fontFamily: string; fontSize: string; fontWeight: string; lineHeight: string; color: string; }; }; effects: { shadows: string[]; radii: string[]; backdropBlurs: string[]; }; layout: { displayTypes: string[]; gapValues: string[]; paddingValues: string[]; }; } /** * Pretty-print and format raw HTML with clean 2-space indentation and semantic readability. */ export declare function beautifyHtml(rawHtml: string): string; export declare function browserExtractDesign(session: CDP.Client, options: ExtractDesignOptions | undefined, config: Config): Promise<{ success: boolean; data: { outputDirectory: string; files: { tokens: string; html?: string; css?: string; tailwind?: string; readme: string; }; tokensSummary: { colors: { backgrounds: string[]; text: string[]; accents: string[]; borders: string[]; }; fonts: string[]; radii: string[]; shadows: string[]; cssVariablesCount: number; }; htmlMetrics?: { nodeCount: number; svgCount: number; htmlBytes: number; }; }; message: string; }>;