Summary
Add a {component}.contract.ts emitter to specs-cli that projects a validated component contract into a framework-agnostic TypeScript file containing prop interfaces, slot signatures, defaults, and slot visibility rules.
RFC
This emitter is specified in RFC 001: Component Dictionary — emitter group contracts, priority high, complexity trivial.
Framework-agnostic TS prop interface + slot signature, no framework imports. Lossless within its idiom; the load-bearing platform emitter for typed languages.
Sketch
rfc/001-component-dictionary/sketches/button.contract.ts
The sketch covers:
- Prop type unions and
interface ButtonProps
ButtonDefaults (as const satisfies Required<...>) for compile-time default enforcement
ButtonSlots interface
SlotVisibility discriminated union (always / whenTrue / whenNotNull)
ButtonSlotRules (as const satisfies Record<keyof ButtonSlots, SlotVisibility>)
The inline comments in the sketch document the mapping from Specs schema types (PropBinding, Conditional, structural absence) to the SlotVisibility consumer-facing form, including an open question on structural-absence recovery that must be resolved before implementation.
Acceptance criteria
Summary
Add a
{component}.contract.tsemitter tospecs-clithat projects a validated component contract into a framework-agnostic TypeScript file containing prop interfaces, slot signatures, defaults, and slot visibility rules.RFC
This emitter is specified in RFC 001: Component Dictionary — emitter group
contracts, priority high, complexity trivial.Sketch
rfc/001-component-dictionary/sketches/button.contract.tsThe sketch covers:
interface ButtonPropsButtonDefaults(as const satisfies Required<...>) for compile-time default enforcementButtonSlotsinterfaceSlotVisibilitydiscriminated union (always/whenTrue/whenNotNull)ButtonSlotRules(as const satisfies Record<keyof ButtonSlots, SlotVisibility>)The inline comments in the sketch document the mapping from Specs schema types (
PropBinding,Conditional, structural absence) to theSlotVisibilityconsumer-facing form, including an open question on structural-absence recovery that must be resolved before implementation.Acceptance criteria
contractsgroupas const satisfies Required<...>SlotVisibilityrules projected fromstyles.visiblebindings and structural variant presence