/** * @name ui/card-builder * @description Fluent builder for MCP Apps UI card rendering. * * CardBuilder provides a fluent API for constructing card HTML without * writing raw template strings in every tool. Each builder call returns * the builder for chaining, and `build()` produces the final HTML string. * * Usage: * const html = new CardBuilder() * .title('Wallet Balance') * .subtitle('mainnet-beta') * .version('0.9.67') * .wallet('3Yfa...TjiB') * .stat('2.5341', 'SOL') * .row('USDC', '15.30') * .row('Network', 'mainnet-beta') * .build(); * * @module ui/card-builder */ import { type RowValueColor } from './card-shell.js'; export interface CardStat { readonly value: string; readonly label: string; readonly color?: RowValueColor; readonly icon?: string; readonly large?: boolean; } export interface CardRowSpec { readonly label: string; readonly value: string; readonly color?: RowValueColor; readonly icon?: string; readonly raw?: boolean; } export interface CardTag { readonly label: string; } export interface CardFullRowSpec extends CardRowSpec { readonly full: true; readonly raw?: boolean; } export declare class CardBuilder { private _title; private _subtitle; private _logo; private _version; private _wallet; private _stats; private _rows; private _fullRows; private _tags; private _issues; private _noGrid; title(t: string): this; subtitle(s: string): this; logo(svg: string): this; version(v: string): this; wallet(w: string): this; stat(value: string, label: string, opts?: { color?: RowValueColor; icon?: string; large?: boolean; }): this; row(label: string, value: string, opts?: { color?: RowValueColor; icon?: string; raw?: boolean; }): this; fullRow(label: string, value: string, opts?: { color?: RowValueColor; icon?: string; raw?: boolean; }): this; tags(...t: string[]): this; issues(...i: string[]): this; noGrid(): this; build(): string; } /** * Macro for creating a balance/wallet card. * @example * balanceCard({ sol: 2.5, usdc: 15, walletAddress: '3Yfa...', network: 'mainnet-beta', version: '0.9.67' }) */ export declare function balanceCard(d: { sol: number; usdc?: number; walletAddress: string; network: string; version: string; }): string; /** * Macro for creating a perp position card. */ export declare function positionCard(d: { market: string; side: 'long' | 'short'; size: number; entryPrice: number; markPrice: number; leverage: number; pnlUsd: number; pnlPct: number; liquidationPrice?: number; version: string; walletAddress?: string; }): string; /** * Macro for creating a generic tool status card. * Used for tools that return simple key-value data. */ export declare function toolStatusCard(d: { toolName: string; status: string; version: string; walletAddress?: string; rows?: Array<{ label: string; value: string; color?: RowValueColor; }>; }): string; export declare function shortAddr(a: string): string; export declare function escapeHtml(t: string): string; /** * Generate a clickable address with Solscan link icon. * Shows the full address truncated to fit, with an external-link icon * that opens Solscan in a new tab. */ export declare function addrLink(addr: string, type?: 'tx' | 'address' | 'token'): string; //# sourceMappingURL=card-builder.d.ts.map