Skip to content

feat: panel refinements - toggles, no WCs, persistence#315

Merged
auniverseaway merged 2 commits intoew-panelsfrom
nx2fixes
Apr 7, 2026
Merged

feat: panel refinements - toggles, no WCs, persistence#315
auniverseaway merged 2 commits intoew-panelsfrom
nx2fixes

Conversation

@auniverseaway
Copy link
Copy Markdown
Member

@auniverseaway auniverseaway commented Apr 4, 2026

  • Remove Lit-based nx-panel block (panel.js/panel.css) in favor of
    utils/panel.js with plain DOM createPanel/showPanel/hidePanel functions
  • Move panel styles from shadow DOM CSS to global styles.css
  • Add action-button block to toggle before/after panels via fragments
  • Extract api.js with daFetch (auth-aware), ping, source, list, signout
  • Rewrite utils.js: environment-aware DA service origins via getEnv,
    improved parseWindowPath (returns null for invalid, strips /index)
  • CSS: replace JS-added classes (spectrum-edge, app-frame) with
    meta-content attribute selectors
  • Simplify profile color scheme toggle, import signout from api.js
  • Add unit tests for utils (parseWindowPath, getEnv, loadStyle) and
    test mocks (IMS, CSS)
  • Panel-aware default-content max-width when side panels are visible

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

@aem-code-sync
Copy link
Copy Markdown

aem-code-sync bot commented Apr 4, 2026

Hello, I'm the AEM Code Sync Bot and I will run some actions to deploy your branch.
In case there are problems, just click the checkbox below to rerun the respective action.

  • Re-sync branch
Commits

@auniverseaway auniverseaway changed the base branch from main to ew-panels April 5, 2026 05:42
@auniverseaway auniverseaway changed the title refactor: nx2 env config, API layer, CSS selectors, and tests feat: replace panel web component with plain DOM utils, extract API layer Apr 5, 2026
@auniverseaway
Copy link
Copy Markdown
Member Author

auniverseaway commented Apr 5, 2026

@hannessolo I really love the approach to panels. Two things about this PR:

  1. I made some small tweaks to the panel implementation...
    1. You can trigger by link (i.e. button)
    2. I think this is a base-level feature, so moved the styles into styles.css.
    3. I moved us away from the web component as it seemed a bit redundant and I'm worried that we'll get into shadow dom query selector hell later down the road.
  2. I'm combining this my other relatively foundational PR. I removed the unrelated changes. This is now only the updates required for the panels.

Hopefully this works for you!

@auniverseaway auniverseaway changed the title feat: replace panel web component with plain DOM utils, extract API layer feat: panel refinements - toggles, no WCs, persistence Apr 6, 2026
@auniverseaway
Copy link
Copy Markdown
Member Author

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:

  1. left panel - chat
  2. right panel - auxilary features (browse, recents, etc.)

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',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread nx2/utils/panel.js Outdated
const { body } = document;
if (getMetadata('template') !== 'app-frame') return;

const beforeMain = [...body.querySelectorAll('aside.panel[data-position="before"]:not([hidden])')];
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@auniverseaway auniverseaway merged commit 63376b6 into ew-panels Apr 7, 2026
3 checks passed
@auniverseaway auniverseaway deleted the nx2fixes branch April 7, 2026 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants