ID:WORK-112Status:readyPriority:highComplexity:moderateMilestone:v1.0.0
Implement named slots with ordering for structure entries
Add a slots array to RuneConfig and slot/order fields to StructureEntry. The engine assembles children by iterating slots in declared order instead of using binary before/after placement. This is the core structural change in SPEC-033 that enables multi-zone layouts.
Acceptance Criteria
RuneConfiginpackages/transform/src/types.tshasslots?: string[]StructureEntryhasslot?: stringandorder?: numberfields- When
slotsis declared, the engine assembles children by iterating slots in order, collecting structure entries per slot sorted byorder, and placing content children at the'content'slot - When
slotsis not declared, existing before/after behavior is unchanged (backward compatible) - When
slotsis declared,before: truemaps to the first non-content slot andbefore: falsemaps to the last non-content slot - Explicit
slotassignments take precedence overbeforemapping mergeThemeConfigmergesslotsarrays (theme replaces base) and structure entries with slot assignments- Unit tests cover: slot assembly ordering, order within slots, content slot placement, backward compat without slots, before-to-slot mapping, merge behavior
- TypeScript compiles cleanly across all packages
- All existing tests pass
Approach
- Add interface changes to
packages/transform/src/types.ts - Modify the engine's child assembly logic in
packages/transform/src/engine.tsto support slot-based ordering whenslotsis present - Implement the backward-compat mapping from
beforeto slot positions - Update
mergeThemeConfiginpackages/transform/src/merge.ts - Write comprehensive tests for slot assembly, ordering, and backward compat
References
- SPEC-033 (Feature 1 — Named Slots with Ordering)
- WORK-110 (value mapping should land first)
- WORK-111 (density contexts should land first)
Relationships
Related
- WORK-114readyworkImplement element projection (hide, group, relocate)
- WORK-116readyworkUpdate inspect and contracts tooling for structure slots features
- SPEC-033acceptedspecStructure Slots and Declarative Flexibility
- WORK-110readyworkAdd value mapping to modifier config
- WORK-111readyworkReplace hardcoded density contexts with configurable childDensity
- WORK-113readyworkAdd repeated element generation to structure entries