Skip to content

Keep a non-default slot's content when its sibling default slot flattens #677

Description

@nathanacurtis

Problem

A component with a default slot and a second ordinary slot loses the second slot's content once the library declares a default-slot convention.

Before the convention is declared, both fills are captured — each as its own slot-content entry, referenced from the nested instance. After it is declared:

  • the default slot's fill correctly flattens into the host's own anatomy, elements and layout
  • the ordinary slot's fill disappears from every concern of the generated spec
  • no warning names it

ADR-099 is explicit that both shapes coexist: a fill into a non-default slot keeps binding through an explicit reference while a default-slot fill nests as plain children, side by side in one spec.

Potential solution(s)

  • Flatten only the default slot's fill, and keep every other slot's fill as the explicit reference it already was
  • If a sibling fill genuinely cannot be carried alongside a flattened one, warn and name the slot rather than dropping its content

Acceptance criteria

  • A two-slot component whose default slot and ordinary slot are both filled keeps both fills in the generated spec
  • The default slot's fill is nested as plain children; the ordinary slot's fill stays an explicit slot-content reference
  • Content is never dropped without a warning naming the slot it belonged to
  • A component with only a default slot, or only ordinary slots, is unchanged

Case data

Notes

Reproduced by declaring slots.default.match: [children, items] in the workspace's spec conventions and regenerating both fixtures:

  • testSlotTwoSlots gains defaultSlot: true on children and nothing on aside — correct
  • testSlotNonDefaultNested then captures the children fill as nested anatomy (root > levelZeroText > level1 > twoSlots > aChild) and loses the aside fill, which previously held a text element

A render round-trip of the resulting spec is otherwise clean and byte-identical in structure, so this is a capture-side loss rather than a render one.

This is the anatomy-capture flattening route, not the ADR-076 container-promotion route. The slot detector's default-slot suppression documents the intent correctly — it skips only the default slot and keeps descending so a non-default slot is still found — so the cause is not yet identified and no line is claimed here.


Implementation details are tracked internally.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

pluginFigma pluginspecs-from-figmaTransformer from Figma into specs

Type

Fields

Priority

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions