import { type NodeSelector } from './nodeSelector.js'; import type { ComponentBranch } from './screenDimensions.js'; import type { RegistryPropValue } from './registry.js'; import type { NodeModel, PageModel } from './store.js'; export interface CardBadgeOption { id: string; /** Panel chip text, and the witness looked for in the product source. */ label: string; /** Registry adapter used when the capture has no donor to clone. */ component: string; props: Readonly>; /** Recognizes this badge in captured markup. */ match: NodeSelector; /** * Fixed position within the slot, mirroring the component's JSX order — the * duplicate-name mark sits before the name, the "new" mark after it. * Without an anchor the badge is appended, which is what a list-shaped slot * (the status chips) wants. */ anchor?: { before?: NodeSelector; after?: NodeSelector; }; } export interface CardSlotDef { id: string; label: string; /** The element inside the card that holds these badges. */ container: NodeSelector; /** 'multiple' (the default) when the product can show several at once. */ arity?: 'single' | 'multiple'; /** * True when the product renders the container only if it has content — an * empty one left behind would still take its gap and padding. */ hideWhenEmpty?: boolean; /** * Where the container belongs when a card does not have one, mirroring the * component's JSX. Required for a `hideWhenEmpty` slot, since those cards * are exactly the ones missing it. */ placement?: { parent: NodeSelector; before?: NodeSelector; after?: NodeSelector; }; options: readonly CardBadgeOption[]; } export interface ScreenCardDef { id: string; label: string; /** The repeated card this composition applies to. */ card: NodeSelector; slots: readonly CardSlotDef[]; /** Product source the branch scanner validates the vocabulary against. */ sourcePath?: string; } export interface ScreenCardDiagnostic { severity: 'error' | 'warning'; cardId: string; message: string; } /** Cards one declaration may open controls for. */ export declare const MAX_CARD_MATCHES = 12; export declare function validateScreenCards(defs: readonly ScreenCardDef[], context: { registry: Readonly>; }>>; scansBySource?: Readonly>; }): ScreenCardDiagnostic[]; export declare function findScreenCards(page: PageModel, def: ScreenCardDef): NodeModel[]; export declare function findCardSlot(card: NodeModel, slot: CardSlotDef): NodeModel | null; /** * A badge is present either as the captured element or as an adapter instance * carrying this option's props — adding one can produce either. */ export declare function nodeIsBadgeOption(node: NodeModel, option: CardBadgeOption): boolean; /** Option ids the card currently shows in this slot. */ export declare function cardSlotSelection(card: NodeModel, slot: CardSlotDef): string[]; export declare function describeScreenCard(card: NodeModel, index: number): string; /** * A captured instance of this badge somewhere else on the screen. Cloning a * real one keeps the product's classes and box; only a badge no card shows * has to be built from the adapter. */ export declare function findBadgeDonor(page: PageModel, option: CardBadgeOption, exclude: NodeModel): NodeModel | null; /** A captured slot container from another card, used when this card lacks one. */ export declare function findSlotDonor(page: PageModel, slot: CardSlotDef, exclude: NodeModel): NodeModel | null; /** * Parent and index where a missing slot container belongs on this card, * from the declared placement. Null when the card has no such parent or the * slot never declared one. */ export declare function findSlotPlacement(card: NodeModel, slot: CardSlotDef): { parent: NodeModel; index: number; } | null; /** Insertion point for an anchored badge, or the end of the slot. */ export declare function badgeInsertIndex(container: NodeModel, option: CardBadgeOption): number; /** One editor's declared screen cards. */ export declare function createScreenCards(): { setScreenCards: (defs: readonly ScreenCardDef[]) => void; getScreenCards: () => readonly ScreenCardDef[]; }; export type ScreenCards = ReturnType;