Resize frame to left when component size changes

I’m fairly new to Figma, seems like this ought to be easy but so far I’m stumped.
I want a frame to grow/shrink to the left when the size of once of its right-aligned components changes. Here’s an example:

When the green box changes size, the red boxes move left / right to maintain spacing. The red and blue boxes are fixed size, and the whole thing is right-aligned in another frame.


One technique that makes this possible is the layer reversal as described in this community file:

The example shows a vertical implementation but you can make it horizontal. By using this technique, the frame will resize to the left instead of right.