import { ProductGridConfig } from '../../context/ProductGridContext'; import { PropellerInfra } from '../../context/PropellerContext'; /** * Declarative resolver for the two-tier prop precedence used by * `ProductCard` / `ClusterCard`: * * explicit prop > ProductGrid context (Tier 2) > Propeller infra (Tier 1) > default * * Without this, each card hand-writes a ~25–40 line object literal of * `props.x ?? grid?.x ?? infra.x ?? d` lines — easy to get the precedence * order wrong per key and impossible to scan. This collapses it to a spec * table. It internally calls the same non-throwing `useInfraProps` and * `useProductGridConfig`, so standalone usage (no provider) still works. * * Spec per key: * - `infra` : fall back to PropellerInfra[key] (Tier 1) * - `grid` : fall back to ProductGridConfig[key] (Tier 2) * - `default`: final fallback when nothing else resolved * - `transform(gridValue)`: when the grid value needs wrapping before use * * A key absent from the spec passes through unchanged. */ type InfraKey = keyof PropellerInfra; type GridKey = keyof ProductGridConfig; interface ResolveSpecEntry { /** Tier-1 infra key to fall back to (after the explicit prop). */ infra?: InfraKey; /** Tier-2 grid-config key to fall back to (after the explicit prop). */ grid?: GridKey; /** Final fallback when neither explicit prop nor context resolved a value. */ default?: unknown; /** Optional adapter applied to the grid value when it is the one chosen. */ transform?: (gridValue: NonNullable) => unknown; } export type ResolveSpec

= Partial>; /** * Resolve `rawProps` against the spec. Call inside `setup()` (it injects the * grid + infra contexts). Wrap the call in a `computed` if the resolved * result must track prop changes. */ export declare function useResolvedProps

(rawProps: P, spec: ResolveSpec

): P; export {};