Skip to content

fix: make sheet block compatible with nx2#1067

Open
hannessolo wants to merge 7 commits into
mainfrom
sheetnx2
Open

fix: make sheet block compatible with nx2#1067
hannessolo wants to merge 7 commits into
mainfrom
sheetnx2

Conversation

Switch from nx-v1-only utility paths (utils/styles.js, utils/svg.js,
utils/script.js) to nx2-compatible imports via utils/utils.js, with a
local inlinesvg fallback for icon loading.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@aem-code-sync

aem-code-sync Bot commented Jun 30, 2026

Copy link
Copy Markdown

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

nx2's loadBlock no longer auto-mounts the block stylesheet, so sheet.js
now adopts sheet.css onto document.adoptedStyleSheets explicitly. Apply
the same pattern for the jspreadsheet stylesheet in utils/index.js.

Update --spacing-* and --body-font-family references to fall through to
nx2's --s2-* equivalents while still resolving in nx v1.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Switch loadStyle imports to ${getNx()}/utils/utils.js and adopt the
returned CSSStyleSheet onto document.adoptedStyleSheets — nx2's
loadStyle returns a stylesheet instead of appending a <link> tag.

In da-assets.js route loadScript through utils/utils.js in nx2 mode,
since /utils/script.js only exists under /nx. In da-library.js map the
base back to /nx so /styles/buttons.css resolves in both modes.

Update --body-font-family references with --s2-font-family fallbacks.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
nx2 renamed --grid-container-width to --se-grid-container-width with
the same 83.4%/1200px breakpoints. Without the fallback, .da-title-inner
and da-content lose their max/explicit width in nx2 and the header
loses its horizontal margin between breakpoints.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Comment thread blocks/edit/da-assets/da-assets.js Outdated
Comment on lines +184 to +186
const loadScript = isNx2
? (await import(`${nx}/utils/utils.js`)).loadScript
: (await import(`${nx}/utils/script.js`)).default;

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.

Is this actually needed? If we load nx2 and we switched. Why the check for old nx?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ok, removed. However, I'm just wondering if that was smart. This will break once we merge - we need to at the same time change nxver=2 into the pages. That might cause ~1-2 mins DA downtime.

Edit and sheet only target nx2 going forward, so remove the isNx2
ternary in da-assets.js and sheet/utils/index.js and import loadScript
directly from utils/utils.js.

Delete the nx v1-shaped fixture stubs (styles.js, svg.js, script.js)
that nothing imports anymore, and expose loadScript from the utils.js
fixture to mirror the nx2 module contract.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@hannessolo hannessolo marked this pull request as ready for review July 7, 2026 14:59
@hannessolo hannessolo requested a review from mhaack July 7, 2026 15:04
nx2 renamed --s2-radius-300 to --s2-corner-radius-800 (same 16px
value). Without the fallback the Cancel/Compare/Restore buttons in the
version preview lose their rounded corners.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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