/** * Layout geometry from a Figma node tree. * * The claude-design adapter captures reference geometry from its own render * (`getBoundingClientRect` per element); Figma exposes the same thing statically * as `absoluteBoundingBox` on every node. Without this the structural layout * diff is a silent no-op for figma-sourced references — `diffLayout` returns * early when the reference side has no bounded elements, so a shifted row reads * as "no findings" rather than "not checked". * * The shape mirrors the claude-design extractor's `treeFromRects`: a flat list * of labelled, bounded children under a root that carries the capture frame, so * the diff engine can recover the density scale between the two sides. */ import type { SemanticTree } from "@design-parity/core"; import type { FigmaNodeDoc, FigmaStyleMeta } from "./figma-api.js"; /** File-level published-style metadata, keyed by style id (`GET /v1/files/:key`). */ export type StyleMap = Record; export interface LayoutOptions { /** * The file's published-style metadata, so a text node wearing a shared style * is keyed by that style's name rather than the anonymous `text`. */ styles?: StyleMap; /** * Source pixels per dp of this frame — see {@link SemanticTree.density}. Pass * it when the board's scale relative to the code is known (a 3× board is `3`), * so a consumer can quote the captured specs in the same unit as the render's. * Omit rather than guess: a wrong factor is worse than a stated `px`. * * It stamps {@link SemanticTree.boundsDensity} too, and not as a shorthand: * the boxes below are `absoluteBoundingBox` values, so they are in the board's * pixels — the very thing this factor converts — and a consumer measuring one * against the other side's dp needs to be told so. Left unstated, a 3× board's * 36px gutter reads as 36dp, and the inset corroboration in * `@design-parity/diff` quietly stops matching a candidate's 12. */ density?: number; } /** * Build a {@link SemanticTree} from a Figma structure node, or `undefined` when * the node carries no `absoluteBoundingBox` (nothing to compare — the diff then * treats the reference as having captured no geometry, which is honest). * * Bounds are made **root-relative** and rounded to whole source pixels: Figma's * absolute boxes are in canvas space, where a frame sitting at x=12040 would * otherwise make every delta meaningless. The root's own box becomes the frame * on `root.bounds`, matching what the claude-design side stamps. */ export declare function layoutFromNode(node: FigmaNodeDoc, options?: LayoutOptions): SemanticTree | undefined; //# sourceMappingURL=layout.d.ts.map