ID:WORK-114Status:done
Implement element projection (hide, group, relocate)
Add a projection field to RuneConfig that enables declarative structural reshaping of the output tree. Projection runs as a distinct pass after BEM class application but before meta tag filtering, operating on data-name addresses. This is SPEC-033's most powerful feature, giving themes control over schema-produced elements.
Priority:mediumComplexity:complexMilestone:v1.0.0Source:SPEC-033
Acceptance Criteria
RuneConfiginpackages/transform/src/types.tshasprojection?: { relocate?, group?, hide? }with the interfaces from SPEC-033- The engine implements a projection pass between Phase 6 (recursion/BEM) and Phase 7 (meta filtering)
- Hide: elements matching
hideentries are removed from the children array entirely - Group: elements matching
membersare collected, removed from current positions, wrapped in a new container withdata-nameset to the group key, and placed at the first collected member's position (or into a named slot) - Relocate: elements found by
data-nameare moved into the target (anotherdata-nameelement or a slot name) at the specified position (prepend/append) - Execution order is hide → group → relocate (so groups can be relocation targets)
- Group wrappers get BEM element classes via normal
applyBemClassesflow mergeThemeConfighandlesprojection(theme projection fully replaces base, not deep-merged)- Unit tests cover: hide removes element, group collects and wraps, relocate moves into target, relocate into slot, combined hide+group+relocate, invalid data-name references are no-ops
- TypeScript compiles cleanly
- All existing tests pass
Approach
- Add
projectioninterfaces to types - Implement the projection pass as a separate function in the engine, called between Phase 6 and Phase 7
- Each sub-pass (hide, group, relocate) walks the children array and applies its transformation
- For
relocatetargeting slots, integrate with the slot assembly from WORK-112 - Update merge logic
- Write comprehensive tests for each operation and their composition
References
- Structure Slots and Declarative Flexibility (Feature 5 — Element Projection)
- Implement named slots with ordering for structure entries (slots — projection relocate can target slot names)
Relationships
Related
ID:WORK-112Status:done0/10
Implement named slots with ordering for structure entries
Priority:highComplexity:moderateMilestone:v1.0.0
ID:WORK-116Status:ready0/7
Update inspect and contracts tooling for structure slots features
Priority:mediumComplexity:moderateMilestone:v1.0.0
ID:WORK-115Status:ready0/7
Migrate community package postTransform uses to declarative config
Priority:mediumComplexity:moderateMilestone:v1.0.0