import { version, Parser, NameAndUrl, RecipeTime, Servings, Section, Ingredient, Cookware, Timer, Quantity, ScaledRecipeWithReport, GroupedQuantity, ingredient_should_be_listed, ingredient_display_name, grouped_quantity_is_empty, grouped_quantity_display, cookware_should_be_listed, cookware_display_name, Content, Step, quantity_display, GroupedIndexAndQuantity, Value } from "./pkg/cooklang_wasm.js"; export { version, Parser, ingredient_should_be_listed, ingredient_display_name, grouped_quantity_is_empty, grouped_quantity_display, cookware_should_be_listed, cookware_display_name, quantity_display }; export type { ScaledRecipeWithReport, Value, Quantity, Ingredient, Cookware, Timer, Section, Content, Step, Item } from "./pkg/cooklang_wasm.js"; /** * Extract a numeric value from a WASM Value type. * * For ranges, returns the start value. * For text values, returns null. * * @param value - The Value to extract from * @returns The numeric value or null if not a number/range * * @example * ```typescript * const value = ingredient.quantity?.value; * const numeric = getNumericValue(value); // 2.5 * ``` */ export declare function getNumericValue(value: Value | null | undefined): number | null; /** * Extract the numeric value from a Quantity. * * Convenience wrapper around getNumericValue for Quantity objects. * * @param quantity - The Quantity to extract from * @returns The numeric value or null * * @example * ```typescript * const qty = getQuantityValue(ingredient.quantity); // 2.5 * ``` */ export declare function getQuantityValue(quantity: Quantity | null | undefined): number | null; /** * Extract the unit string from a Quantity. * * @param quantity - The Quantity to extract from * @returns The unit string or null if no unit * * @example * ```typescript * const unit = getQuantityUnit(ingredient.quantity); // "cups" * ``` */ export declare function getQuantityUnit(quantity: Quantity | null | undefined): string | null; /** * Simple ingredient with display-ready values. * For more control, use recipe.groupedIngredients with the display functions. */ export interface FlatIngredient { /** Display name of the ingredient */ name: string; /** Numeric quantity (start of range if range), or null if none */ quantity: number | null; /** Unit string, or null if none */ unit: string | null; /** Formatted display text for the quantity (e.g., "1-2 cups", "3/4 tsp") */ displayText: string | null; /** Optional note/modifier (e.g., "finely chopped") */ note: string | null; } /** * Simple cookware with display-ready values. */ export interface FlatCookware { /** Display name of the cookware */ name: string; /** Numeric quantity, or null if none */ quantity: number | null; /** Formatted display text for the quantity */ displayText: string | null; /** Optional note/modifier */ note: string | null; } /** * Simple timer with display-ready values. */ export interface FlatTimer { /** Optional timer name */ name: string | null; /** Numeric quantity (in seconds after unit conversion), or null if none */ quantity: number | null; /** Unit string (e.g., "minutes", "hours"), or null if none */ unit: string | null; /** Formatted display text for the quantity */ displayText: string | null; } /** * Get a flat list of all ingredients with simple, display-ready values. * * This is a convenience function for simple use cases. For more control over * grouping and display, use recipe.groupedIngredients with the display functions. * * @param recipe - The parsed recipe * @returns Array of flat ingredient objects * * @example * ```typescript * const ingredients = getFlatIngredients(recipe); * ingredients.forEach(ing => { * console.log(`${ing.displayText || ''} ${ing.name}`); * }); * ``` */ export declare function getFlatIngredients(recipe: CooklangRecipe): FlatIngredient[]; /** * Get a flat list of all cookware with simple, display-ready values. * * @param recipe - The parsed recipe * @returns Array of flat cookware objects * * @example * ```typescript * const cookware = getFlatCookware(recipe); * cookware.forEach(cw => { * console.log(`${cw.displayText || ''} ${cw.name}`); * }); * ``` */ export declare function getFlatCookware(recipe: CooklangRecipe): FlatCookware[]; /** * Get a flat list of all timers from the recipe. * * @param recipe - The parsed recipe * @returns Array of flat timer objects * * @example * ```typescript * const timers = getFlatTimers(recipe); * timers.forEach(timer => { * console.log(`${timer.name}: ${timer.displayText}`); * }); * ``` */ export declare function getFlatTimers(recipe: CooklangRecipe): FlatTimer[]; export declare class CooklangRecipe { title?: string; description?: string; tags: Set; author?: NameAndUrl; source?: NameAndUrl; course: any; time?: RecipeTime; servings?: Servings; difficulty: any; cuisine: any; diet: any; images: any; locale?: [string, string | null]; custom_metadata: Map; rawMetadata: Map; sections: Section[]; ingredients: Ingredient[]; cookware: Cookware[]; timers: Timer[]; inlineQuantities: Quantity[]; groupedIngredients: [Ingredient, GroupedQuantity][]; groupedCookware: [Cookware, GroupedQuantity][]; constructor(raw: ScaledRecipeWithReport, groupedIngredients: GroupedIndexAndQuantity[], groupedCookware: GroupedIndexAndQuantity[]); } export declare class CooklangParser { private parser; constructor(); parse(input: string, scale?: number | null): [CooklangRecipe, string]; set units(value: boolean); get units(): boolean; set extensions(value: number); get extensions(): number; } export declare class HTMLRenderer { protected result: string; protected recipe: CooklangRecipe; render(recipe: CooklangRecipe): string; protected renderMetadata(metadata: Map): void; protected renderMetadatum(key: any, value: any): void; protected renderGroupedIngredients(ingredients: [Ingredient, GroupedQuantity][]): void; protected renderGroupedIngredientHelper(ingredient: Ingredient, quantity: GroupedQuantity): void; protected renderGroupedIngredient(name: string, quantity: string | null, note: string | null): void; protected renderGroupedCookwares(cookwares: [Cookware, GroupedQuantity][]): void; protected renderGroupedCookwareHelper(cookware: Cookware, quantity: GroupedQuantity): void; protected renderGroupedCookware(name: string, quantity: string | null, note: string | null): void; protected renderSections(sections: Section[]): void; protected renderContent(current_section: Section, content: Content): void; protected renderStep(current_section: Section, step: Step): void; protected renderInlineIngredient(current_section: Section, ingredient: Ingredient): void; protected renderInlineTimer(timer: Timer): void; private renderInlineQuantity; private renderInlineCookware; }