import { Expr, GpuShaderDefinition } from '../contract'; import { BoundingBoxBindingType, BoundingBoxDeclaration, ComponentProps, PropConfig } from '../../types'; import { shapeStrokeProps } from '../../utilities/propConfigs'; /** * Any prop config, whatever the prop's value type. Shape props are heterogeneous by nature (a * number, a `DimensionalValue`, a colour string), and the factory only ever moves them around, so * the value type is deliberately unconstrained here — the shader's own `ComponentProps` interface is * where the per-prop types are stated. */ type AnyPropConfig = PropConfig; /** * How the shape's bounding box is declared. * * `size` is the declarative form thirteen shapes use: x/y bind `center`, width/height bind the * named size props, and rotation binds `rotation` unless `rotatable: false`. `as` defaults to * `'half-canvas-height'` (the prop is a half-extent); Circle passes `'canvas-height'` because its * `radius` names the full visual size and the shader halves it internally. * * `custom` is the escape hatch for the two shapes whose box cannot be read off a single prop: Ring * (outer edge = midline radius + half-band thickness) and Trapezoid (visual width = the WIDER of * its two edges). Those pass a complete `BoundingBoxDeclaration` — `computeBounds` / `writeBounds` * are per-shape geometry, not something a factory can infer. */ export type SdfShapeBounds = { size: { width: string; height: string; as?: BoundingBoxBindingType; }; custom?: never; } | { custom: BoundingBoxDeclaration; size?: never; }; export interface SdfShapeShaderSpec { name: string; description: string; /** Defaults to `'Shapes'`. */ category?: string; /** * The shape's geometry, as algebra over the shape-local frame (aspect-corrected, centered, * rotated — y grows downward like the SDF kit). `u(name)` reads a prop uniform. Returns the * signed distance; the factory applies the fill/stroke/softness mask. */ distance: (local: { x: Expr; y: Expr; }, u: (name: string) => Expr) => Expr; /** The `color` prop's description ("Fill color of the star"). */ colorDescription: string; /** The `center` prop's description ("Center position of the star"). */ centerDescription: string; /** Circle labels its center prop 'Center Position'; the rest use the factory default. */ centerLabel?: string; /** The 1–3 props that make this shape itself, in declaration order. */ shapeProps: Record; /** `false` for the rotationally symmetric shapes (Circle, Ring): no rotation prop, no rotation box axis. */ rotatable?: boolean; /** Cross explains the 45° case; everything else uses the default wording. */ rotationDescription?: string; bounds: SdfShapeBounds; /** Passed straight to `shapeStrokeProps` (Ring's wording + max, Circle's wording). */ stroke?: Parameters[0]; /** Circle's `colorSpace` description mentions soft edges. */ colorSpaceDescription?: string; /** * Prop configs that REPLACE a factory-built one, keyed by prop name. Spread last, so a replaced * prop keeps its position in the key order. Circle uses this for its widened, map-driveable * `softness` / `strokeThickness`. */ propOverrides?: Record; /** * Explicit prop key order, when the shader's current order is not the fleet-canonical one. * Must list every prop exactly once — a mismatch throws, because a silently dropped prop would * change the uniform struct. */ propOrder?: string[]; } /** * Build a complete analytic-2D-shape shader definition from its shape props, its mask body fn and * its box declaration. * * The emitted definition is byte-identical to the hand-written one for all fifteen migrated shapes * (Gate A): same props in the same order, same `boundingBoxDeclaration`, and a fragment that emits * the same `call` sequence. */ export declare function defineSdfShapeShader(spec: SdfShapeShaderSpec): GpuShaderDefinition; export {}; //# sourceMappingURL=sdfShape.d.ts.map