/** * Object-literal / conditional-spread → Jinja dict lowering for the Jinja * template adapter. * * Ported from `packages/adapter-xslate/src/adapter/spread/spread-codegen.ts`. * Free functions taking a `JinjaSpreadContext` (built by the adapter's * `spreadCtx` getter) so the cluster depends on the narrow seam — the * recursive expression entry plus per-compile bookkeeping — rather than the * whole adapter class. * * The conditional-spread / object-literal entries read the IR-carried * structured `ParsedExpr` tree (#2018) instead of re-parsing the source with * `ts.createSourceFile`. The condition and scalar values are threaded * straight into `ctx.convertExpressionToJinja` as its `preParsed` argument, * so no stringify→re-parse round-trip occurs. The `ts.factory` rebuild in * `recordIndexAccessToJinja` only reconstructs the `IDENT[KEY]` node the * shared `parseRecordIndexAccess` parser accepts; no source-text re-parse. */ import type { ParsedExpr } from '@barefootjs/jsx'; import type { JinjaSpreadContext } from '../emit-context.ts'; /** * Lower a conditional inline-object spread * `COND ? { 'aria-describedby': describedBy } : {}` * to a Jinja inline ternary of dicts * `({'aria-describedby': describedBy} if bf.truthy(describedBy) else {})`. * Reads the IR-carried structured `ParsedExpr` tree; both branches must be * object literals; the condition + values route through * `convertExpressionToJinja`. Returns `null` for any other shape so the * caller falls back to its normal lowering. */ export declare function conditionalSpreadToJinja(ctx: JinjaSpreadContext, expr: ParsedExpr | undefined): string | null; /** * (#1971) Lower a bare object-literal expression (`{ align: 'start' }`), * carried as the IR's structured `ParsedExpr` tree, to a Jinja dict via * `objectLiteralToJinjaDict`, or null when it isn't a plain object literal. * Used for inline object-literal child props (carousel `opts`). */ export declare function objectLiteralExprToJinjaDict(ctx: JinjaSpreadContext, expr: ParsedExpr | undefined): string | null; /** * Convert a static object literal into a Jinja dict string for a * conditional spread. Only static string/identifier keys are allowed; values * resolve via `convertExpressionToJinja` (or the `Record[propKey]` index * lowering). Returns `null` for any computed/spread/dynamic key. Empty * object → `{}`. */ export declare function objectLiteralToJinjaDict(ctx: JinjaSpreadContext, obj: Extract): string | null; /** * Lower a spread-object VALUE of the form `IDENT[KEY]` (CheckIcon's * `sizeMap[size]`) to an inline indexed Jinja dict * `{'sm': 16, 'md': 20, ...}[size]`. * Reuses the shared structural parse (`parseRecordIndexAccess`) — rebuilding * the `IDENT[KEY]` node from the carried tree via `ts.factory` rather than * re-parsing source text; this wrapper only does the single-quote escaping + * bracket-index emit. Jinja indexes a dict literal with the SAME bracket * syntax `{…}[key]` a JS object index would use — no Kolon-style divergence * to steer around here. */ export declare function recordIndexAccessToJinja(ctx: JinjaSpreadContext, val: ParsedExpr): string | null; //# sourceMappingURL=spread-codegen.d.ts.map