Skip to content

Apply a non-image prop binding on render, or settle that it cannot be #684

Description

@nathanacurtis

Problem

When render places a nested instance, a prop configuration that is a $binding — the instance's property staying wired to the host component's own prop — is not applied. The instance renders at its main component's default instead, so a pass-through is silently converted into a hardcoded value.

A $nested deep configuration, addressing an instance further down a chain, is likewise not applied.

Both now emit a warning naming the element and prop, so they are visible rather than silent, but neither is implemented.

Potential solution(s)

  • Apply the bindings the platform supports: a nested layer's visibility, its text content, and its swapped component can each be wired to a host property by reference
  • Establish whether a nested instance's variant property can be bound at all, and if not, decide what the spec should mean for one — refuse it, warn once per run, or record it as unrenderable
  • Apply $nested by walking the instance chain the path names

Acceptance criteria

  • A binding whose target is a nested layer's visibility, text content, or swapped component renders bound, not at the default
  • A binding whose target is a nested instance's variant property either renders bound, or is reported as unsupported with a reason a reader can act on
  • A $nested deep configuration is applied, or reported with the path it could not reach
  • No binding is dropped without the element and prop being named

Case data

  • Fixture: Slot Passthrough, Slot Non Default Nested
  • Workspace: specs-testing
  • Territory: figma-from-specs
  • Size: m

Notes

Split from #673, which covered this together with the slot-fill half. That half is done and round-trip verified; this one is unstarted and gated on a platform question, so they no longer belong together.

What the platform offers, read from the Plugin API typings rather than inferred. A node property can be wired to a containing component's property through componentPropertyReferences, and the admissible keys are exactly three: visible, characters, and mainComponent. Those correspond to a boolean pass-through, a text pass-through, and an instance-swap pass-through, and they apply to a sublayer's node property.

A nested instance's own component property — its size variant, say — is not in that set. So the general case this issue describes has no setter in the API as typed, and the three cases that do are narrower than the spec's $binding is. That is the question to settle before implementing: which bindings a spec can actually carry through a render, and what the contract should say about the rest.

Worth confirming against the current Plugin API documentation rather than the typings alone before building anything.


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

figma-from-specsTransformer from specs into Figma assetspluginFigma plugin

Type

Fields

Priority

None yet

Projects

  • Status
    Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions