feat: panel refinements - toggles, no WCs, persistence#315
feat: panel refinements - toggles, no WCs, persistence#315auniverseaway merged 2 commits intoew-panelsfrom
Conversation
|
@hannessolo I really love the approach to panels. Two things about this PR:
Hopefully this works for you! |
|
Some non-critical open questions / comments: We could easily ditch the fragments in favor of just loading a block directly. We would lose flexibility in that we could associate different blocks in authoring without a release, but I'm not sure we would actually use this. We may want to slice this differently anyway... It seems like we pretty much know what we want each panel to always be:
I think this is good for now. Later down the road we may want to allow different views to determine what panels they get. This will be especially true if the auxilery panel becomes a nightmare to support. |
| import { showPanel, hidePanel, unhidePanel } from '../../utils/panel.js'; | ||
|
|
||
| const FRAGMENT_PATHS = { | ||
| before: '/nx/fragments/before-panel', |
There was a problem hiding this comment.
I don't think these should be so hard-coded.
Maybe instead we should use the link in the button as the fragment path, something like /path/to/fragment#_open=panelBefore
There was a problem hiding this comment.
I think we're wondering the same thing, then. Let's do this:
We ditch the forced fragment abstraction. You supply a path to a block. If you want a fragment, the block you link to can provide it. Then in action button it is:
/tools/widgets/panel#_before=chat
Which means /blocks/chat/chat.js.
We could optionally support either now or later:
/tools/widgets/panel#_before=/fragments/panels/left
And if we run across a path that has fragments in it, we know to automatically use the fragment.js block.
| const { body } = document; | ||
| if (getMetadata('template') !== 'app-frame') return; | ||
|
|
||
| const beforeMain = [...body.querySelectorAll('aside.panel[data-position="before"]:not([hidden])')]; |
There was a problem hiding this comment.
This is working in the assumption that we can have multiple panels before/after. That was part of Kilian's design (think power users wanting to have 2 panels open) but I'm not 100% sure we should support it or not.
Based on your button impl, it seems we might only want to support 1 panel each side - in which case this code could be simplified.
There was a problem hiding this comment.
Yeah, I just told Claude to remove the WC piece, so I'm not sure what all is plumbed in there.
I do think we only allow three panels max, and for now, it's only one on each side.
utils/panel.js with plain DOM createPanel/showPanel/hidePanel functions
improved parseWindowPath (returns null for invalid, strips /index)
meta-content attribute selectors
test mocks (IMS, CSS)
Co-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com
Panels
https://nx2fixes--da-nx--adobe.aem.page/drafts/cmillar/panels
DA.LIVE prod + this NX2 PR + NX1
https://main--da-live--adobe.aem.live/?nx=nx2fixes
Expectation: this works E2E
DA.LIVE stage + this NX2 PR + NX2
https://dasites--da-live--adobe.aem.page/?nx=nx2fixes&nxver=2
Expectation: only da homepage works, but is correctly styled