import type { PurchaseOrderPrintTemplateData } from '../types/print-data'; export interface ConfigFieldToggle { key: string; label: string; type: 'toggle'; value: boolean; } export interface ConfigFieldText { key: string; label: string; type: 'text'; value: string; placeholder?: string; maxLength?: number; } export interface ConfigFieldTextarea { key: string; label: string; type: 'textarea'; value: string; placeholder?: string; rows?: number; } export interface ConfigFieldNumber { key: string; label: string; type: 'number'; value: number; min?: number; max?: number; step?: number; unit?: string; } export interface ConfigFieldSelect { key: string; label: string; type: 'select'; value: string; options: { label: string; value: string; }[]; } export interface ConfigFieldColor { key: string; label: string; type: 'color'; value: string; } export type ConfigField = ConfigFieldToggle | ConfigFieldText | ConfigFieldTextarea | ConfigFieldNumber | ConfigFieldSelect | ConfigFieldColor; /** Build a flat config object from configFields for Handlebars context */ export declare function configFieldsToValues(fields: ConfigField[]): Record; export interface BlockDefinition { tag: F_PURCHASE_ORDER_PRINT_BLOCK_TYPE; label: string; icon: string; /** Handlebars partial template string */ template: string; /** Return initial config fields with values for a new block */ initialConfigFields: () => ConfigField[]; } export declare const BLOCK_DEFINITIONS: Record; /** * Compile a block's Handlebars template with config values. * Resolves config conditionals (e.g. {{#if showCode}}) but preserves * data placeholders (e.g. {{orderNumber}}, {{#each items}}). * * The trick: we compile the template passing config values as top-level context, * but also pass stub data so data placeholders remain as literal output. * Since Handlebars outputs empty string for undefined variables, we use a * two-pass approach: first pass resolves config, second pass is at print time. * * Actually, for simplicity and reliability, we store the raw template string * with config values embedded — the config conditionals are part of the * Handlebars template and will be resolved at render time using the saved * config values. The templateHtml IS the raw Handlebars template from * BLOCK_DEFINITIONS, but frozen at the point of save so future code changes * to BLOCK_DEFINITIONS don't affect saved templates. */ export declare function compileBlockTemplateHtml(tag: string, configFields: ConfigField[]): string; /** Build a block config from a BlockDefinition — creates configFields and compiles templateHtml */ export declare function buildBlockConfig(tag: F_PURCHASE_ORDER_PRINT_BLOCK_TYPE): Record; /** Default preset matching the current hardcoded layout */ export declare function getDefaultBlocks(): FdoPrintTemplateBlock[]; /** Generate a unique block ID */ export declare function generateBlockId(): string; /** Sample data for live preview */ export declare function getSamplePrintData(templateType?: string): PurchaseOrderPrintTemplateData;