/** * Walking a design kit, page by page. * * A kit's node ids are not discoverable without API access — Figma's Dev Mode * MCP server exposes only the page a user is looking at, and Code Connect * (which would hand the mapping back directly) is gated behind a paid seat. So * the ids come from the REST API, and this is the walk that collects them. * * Two things make the walk worth doing at a depth a parity run never needs: * * 1. A component set the matcher never offered may be **missing** or merely * **deeper than the walk reached**, and those call for opposite responses. * Recording `deepest` per page makes the difference legible. * 2. Instances are only visible here. A definition renders at its property * defaults; an instance renders at whatever someone chose, which is the only * handle a property-shaped variant can be paired with. * * The result is a disposable artifact — big, regenerable, and the input to * {@link file://./build.ts | the index build}, which is the small committed one. */ import type { FigmaNodeDoc, FigmaRestClient } from "@design-parity/adapter-figma"; import type { InventoryComponent, InventoryInstance, KitInventory } from "./types.js"; /** How deep to descend a page by default. */ export declare const DEFAULT_WALK_DEPTH = 8; /** What one page's walk found, before any filtering by reference. */ export interface PageWalk { components: InventoryComponent[]; instances: InventoryInstance[]; /** Deepest level reached — how much of the tree the `depth` bound bought. */ deepest: number; } /** * Collect every component, component set and visible instance under `root`. * * Pure: no network, no filtering by what a design map references. Exported so * the classification below can be pinned against hand-built trees. * * A component set's variants are NOT recorded as separate components — they are * its `children`. A ref belongs on a variant rather than on the set, because a * set frame is a variant grid whose own geometry is an editor artifact. */ export declare function walkPage(root: FigmaNodeDoc): PageWalk; /** * Split a page's instances into the two kinds the index keeps. * * `renderInstances` stand in for definitions that cannot be exported at all * (a hidden set). `propertyInstances` are renderable alternatives to * definitions that CAN be exported but only at their defaults. * * The property instances are narrowed to sets the design map actually * references, because a kit page can hold hundreds of unrelated screen * instances and retaining all of them would turn a focused index into a second * copy of the document. */ export declare function classifyInstances(walk: PageWalk, referencedNodeIds: ReadonlySet): { renderInstances: InventoryInstance[]; propertyInstances: InventoryInstance[]; }; export interface DumpInventoryOptions { client: FigmaRestClient; fileKey: string; /** How deep to descend each page. Defaults to {@link DEFAULT_WALK_DEPTH}. */ depth?: number; /** * Node ids the design map already references. Property instances are kept * only for the sets these belong to; an empty set keeps none, which is the * right answer for a first run with no map yet. */ referencedNodeIds?: ReadonlySet; /** Refs to resolve back to their nodes, for a "what do we point at?" report. */ mappedRefs?: { code: string; nodeId: string; }[]; /** Progress sink. Defaults to silent, so library use prints nothing. */ log?: (message: string) => void; } /** * Walk every page of a kit and record what it contains. * * A page that fails is recorded with its error and the walk continues: one * unreadable page should cost that page, not the run. The client's own retry * policy has already dealt with the transient cases by the time an error * reaches here. */ export declare function dumpInventory(opts: DumpInventoryOptions): Promise; //# sourceMappingURL=inventory.d.ts.map