Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Try: Components decorator extensibility pattern #1023
Experimental: These changes are highly incomplete, unpolished, and break nearly as much functionality as they introduce.
This pull request seeks to explore a decorator pattern for extensibility. It is primarily composed of two parts:
The use-case explored was that of wide image rendering, which is unique in that it depends on a relationship between two components: The
Instead I landed on the idea of namespaced extension state to be shared between all component decorators registered by
The approach differs from react-slot-fill in that a slot can be occupied by one or more fill to be rendered as a child, whereas a decorator wraps the original component and has power to replace or augment the original render behavior. I've not yet settled on whether the decorator pattern could serve as a complete replacement for slot/fill, or if the two complement each other in their own independent purpose. If slots were to remain, I think it could fit well within the existing API via
As noted, there is breakage resulting from these changes, notably floated content. Observe though that Wide alignment (image, video, etc) stretches to occupy the full width.
Mmm, good exploration, here are some initial thought/questions: