feat: slot layouts over wrapping operations#196
feat: slot layouts over wrapping operations#196arbrandes wants to merge 3 commits intoopenedx:mainfrom
Conversation
|
@jsnwesson and @MaxFrank13, would love your thoughts on this, as I suspect you might actually use FPF's wrap operation. |
holaontiveros
left a comment
There was a problem hiding this comment.
It makes a lot of sense, I still haven't seen in depth the old system I just check a couple of things on how it worked before so given that many thigns will need to be fully migrated to be compatible with frontend-base maybe we should have some links to some succesful migrations after they start appearing, so everyone can do it easily.
I does look straighforward but depending on how the people look at it some example to wrap their head saround it may be helpful
Totally. I originally thought about converting frontend-plugin-aspects itself, but unfortunately it targets slots in frontend-app-authoring, which is the last one on the list to be converted to frontend-base. We'll figure something out in the docs. |
Document the decision to not implement a widget wrapping operation in frontend-base, recommending layout replacements as the architecturally preferred alternative. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
623af19 to
68c7401
Compare
Expose byId(), withoutId(), byRole(), and withoutRole() methods on the array returned by useWidgets(), enabling layouts to selectively render widgets by identity without breaking backwards compatibility. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add a ToggleByRoleLayout demo that uses the new widgets.byRole() helper to toggle between all widgets and only those with a highlighted role. Also fix two options values in the showcase that were passing JSX elements instead of plain strings, causing the options to be ignored by the type checks in their respective layouts. Remove outdated wrapping reference from the showcase intro text. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Description
Adds an ADR documenting the decision to not implement a widget wrapping operation in frontend-base. The legacy
@openedx/frontend-plugin-frameworkprovided aWrapoperation, used notably byfrontend-plugin-aspectsto toggle sidebar visibility. The ADR explains why the existing layout system is the architecturally preferred alternative, and why a wrapping operation is fundamentally at odds with the slot/layout/widget pipeline.As part of this decision,
useWidgets()is enriched with identity-based filtering helpers (byId(),withoutId(),byRole(),withoutRole()). These methods let layouts selectively render widgets without breaking backwards compatibility — the returned array still renders identically when used as-is. Internally, the widget metadata (ID and role) that was previously stripped before reaching layouts is now preserved and exposed through these helpers.The slot showcase gains a new demo showing
widgets.byRole()in action: a layout that toggles between all widgets and only those with a "highlighted" role. Two existing showcase options that were passing JSX elements instead of plain strings are also fixed.LLM usage notice
Built with assistance from Claude models (mostly Opus 4.6).