Skip to content

Commit 2d894df

Browse files
authored
Merge pull request #588 from adobe/feat/bulk-block-nx2-migration
Feat/bulk block nx2 migration
2 parents 211df8f + d7d1596 commit 2d894df

5 files changed

Lines changed: 56 additions & 53 deletions

File tree

WORKLOG.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,30 @@ Changed `:root { color-scheme: light dark; }` → `color-scheme: light;` and `.d
88

99
## 2026-07-09
1010

11+
### nx/blocks/bulk — migrate bulk operations block to nx2
12+
13+
Added `'bulk'` to `NX_BLOCKS` in `nx2/scripts/nx.js`. Block stays in `nx/blocks/bulk/` per migration convention.
14+
15+
Import updates in `bulk.js`:
16+
- `../../deps/lit/lit-core.min.js``da-lit`
17+
- Dropped `getConfig` from nexter.js; icon URL built via `new URL('../../img/icons/...', import.meta.url).href` (icon only exists in nx1)
18+
- `../../public/utils/tree.js``../../../nx2/public/utils/tree.js` (Queue)
19+
- `../../utils/svg.js` `getSvg``../../../nx2/utils/svg.js` default `loadIcons` (compatible `{ paths } → Promise<svg[]>` signature)
20+
- `../../utils/styles.js` default `getStyle``{ loadStyle }` from `../../../nx2/utils/utils.js`
21+
22+
Import updates in `index.js`:
23+
- `../../public/utils/getExt.js``../../../nx2/public/utils/getExt.js`
24+
- `../../utils/daFetch.js``../../../nx2/utils/api.js`
25+
- `../../public/utils/constants.js``../../../nx2/public/utils/constants.js`
26+
- **API signature change:** nx2's `daFetch` uses destructured args, so `daFetch(url, opts)``daFetch({ url, opts })`
27+
28+
CSS variables in `bulk.css` mapped to nx2-first-nx1-fallback:
29+
- `--grid-container-width``--se-grid-container-width`
30+
- `--spacing-*``--s2-spacing-*`
31+
- `--body-font-family``--s2-font-family`
32+
- `--s2-radius-100``--s2-corner-radius-500`
33+
- `--s2-font-size-600` (31px) → `--s2-heading-size-xl` (36px, closest available)
34+
1135
### nx/blocks/tree/tree.js — migrate tree block to nx2
1236

1337
Added `'tree'` to `NX_BLOCKS` in `nx2/scripts/nx.js` so the block always loads from `/nx/blocks`.

nx/blocks/bulk/bulk.css

Lines changed: 21 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,21 @@
11
:host {
22
display: block;
3-
max-width: var(--grid-container-width);
4-
margin: 0 auto var(--spacing-500) auto;
5-
}
6-
7-
:host > svg {
8-
display: none;
9-
}
10-
11-
button {
12-
font-family: var(--body-font-family);
3+
max-width: var(--se-grid-container-width, var(--grid-container-width));
4+
margin: 0 auto var(--s2-spacing-500, var(--spacing-500)) auto;
135
}
146

157
sl-textarea {
168
height: 320px;
17-
margin-bottom: var(--spacing-400);
9+
margin-bottom: var(--s2-spacing-400, var(--spacing-400));
1810
}
1911

2012
sl-select {
2113
width: 120px;
2214
}
2315

24-
input[name="label"] {
25-
height: 32px;
26-
width: 160px;
27-
font-family: var(--body-font-family);
28-
margin: 0;
29-
padding: 0 6px;
30-
}
31-
3216
.delete-toggle {
33-
background: #ff5d4b;
34-
border-radius: 8px;
17+
background: var(--s2-red-700);
18+
border-radius: var(--s2-corner-radius-500, 8px);
3519
line-height: 32px;
3620
padding: 0 10px;
3721
color: #fff;
@@ -58,7 +42,7 @@ input[name="label"] {
5842
justify-content: end;
5943
align-items: end;
6044
gap: 12px;
61-
margin: 0 0 var(--spacing-400);
45+
margin: 0 0 var(--s2-spacing-400, var(--spacing-400));
6246
}
6347

6448
.da-bulk-action-submit button {
@@ -69,39 +53,39 @@ input[name="label"] {
6953
display: grid;
7054
grid-template-columns: 1fr 1fr 1fr 1fr;
7155
gap: 24px;
72-
margin: 0 0 var(--spacing-400);
56+
margin: 0 0 var(--s2-spacing-400, var(--spacing-400));
7357
}
7458

7559
.detail-card {
7660
display: flex;
7761
justify-content: space-between;
78-
background: rgb(215 247 225);
62+
background: var(--s2-green-200);
7963
border-radius: 18px;
8064
overflow: hidden;
81-
padding: var(--spacing-400);
65+
padding: var(--s2-spacing-400, var(--spacing-400));
8266

8367
button {
8468
background: transparent;
8569
}
8670
}
8771

8872
.detail-card-remaining {
89-
background: rgb(202 248 250);
73+
background: var(--s2-cyan-200);
9074
}
9175

9276
.detail-card-total {
93-
background: rgb(181 230 252);
77+
background: var(--s2-cyan-300);
9478
}
9579

9680
.detail-card-errors {
97-
background: rgb(255 214 209);
81+
background: var(--s2-red-300);
9882
}
9983

10084
.detail-card .cancel-button {
10185
margin: 0;
10286
padding: 0;
10387
min-width: 72px;
104-
border-radius: var(--s2-radius-100);
88+
border-radius: var(--s2-corner-radius-500, var(--s2-radius-100));
10589
border: none;
10690
background: rgb(0 0 0 / 10%);
10791
}
@@ -113,36 +97,36 @@ input[name="label"] {
11397
}
11498

11599
.detail-card h3 {
116-
margin-bottom: var(--spacing-100);
100+
margin-bottom: var(--s2-spacing-100, var(--spacing-100));
117101
}
118102

119103
.detail-card p {
120-
font-size: var(--s2-font-size-600);
104+
font-size: var(--s2-heading-size-xl, var(--s2-font-size-600));
121105
}
122106

123107
.url-list {
124108
display: none;
125-
background: rgb(215 247 225);
109+
background: var(--s2-green-200);
126110
border-radius: 18px;
127111
overflow: hidden;
128-
padding: var(--spacing-400);
129-
margin: 0 0 var(--spacing-400);
112+
padding: var(--s2-spacing-400, var(--spacing-400));
113+
margin: 0 0 var(--s2-spacing-400, var(--spacing-400));
130114
}
131115

132116
.url-list.is-expanded {
133117
display: block;
134118
}
135119

136120
.url-list-remaining {
137-
background: rgb(202 248 250);
121+
background: var(--s2-cyan-200);
138122
}
139123

140124
.url-list-errors {
141-
background: rgb(255 214 209);
125+
background: var(--s2-red-300);
142126
}
143127

144128
.url-list-total {
145-
background: rgb(202 248 250);
129+
background: var(--s2-cyan-200);
146130
}
147131

148132
.url-list h2 {

nx/blocks/bulk/bulk.js

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
1-
import { LitElement, html, nothing } from '../../deps/lit/lit-core.min.js';
2-
import { getConfig } from '../../scripts/nexter.js';
1+
import { LitElement, html, nothing } from 'da-lit';
32
import { formatUrls, sendAction } from './index.js';
4-
import { Queue } from '../../public/utils/tree.js';
5-
import { getSvg } from '../../utils/svg.js';
6-
import getStyle from '../../utils/styles.js';
3+
import { Queue } from '../../../nx2/public/utils/tree.js';
4+
import { loadStyle } from '../../../nx2/utils/utils.js';
75

86
await import('../../public/sl/components.js');
9-
const style = await getStyle(import.meta.url);
10-
11-
const { nxBase: nx } = getConfig();
12-
const icons = await getSvg({ paths: [`${nx}/img/icons/Smock_ChevronRight_18_N.svg`] });
7+
const style = await loadStyle(import.meta.url);
138

149
// const MOCK_URLS = 'https://main--docket--da-pilot.aem.page/about/faq\nhttps://main--docket--da-pilot.aem.page/about/release-notes\nhttps://main--docket--da-pilot.aem.page/about/release-notes/da-admin\nhttps://main--docket--da-pilot.aem.page/about/release-notes/da-collab\nhttps://main--docket--da-pilot.aem.page/about/release-notes/da-content\nhttps://main--docket--da-pilot.aem.page/about/release-notes/da-live';
1510

@@ -38,7 +33,6 @@ class NxBulk extends LitElement {
3833
connectedCallback() {
3934
super.connectedCallback();
4035
this.shadowRoot.adoptedStyleSheets = [style];
41-
this.shadowRoot.prepend(...icons);
4236
}
4337

4438
firstUpdated() {
@@ -153,7 +147,7 @@ class NxBulk extends LitElement {
153147
${hasCancel ? html`<button class="cancel-button" @click=${this.handleCancel}>${this._cancelText}</button>` : nothing}
154148
${hasExpand ? html`
155149
<button class="toggle-list-icon" @click=${this.handleToggleList} data-name="${lowerName}">
156-
<svg class="icon"><use href="#spectrum-chevronRight"/></svg>
150+
<svg class="icon" viewBox="0 0 20 20" aria-hidden="true"><use href="/img/icons/s2-icon-chevronright-20-n.svg#icon"/></svg>
157151
</button>
158152
` : nothing}
159153
</div>

nx/blocks/bulk/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { getExt } from '../../public/utils/getExt.js';
2-
import { daFetch } from '../../utils/daFetch.js';
3-
import { DA_ORIGIN } from '../../public/utils/constants.js';
1+
import { getExt } from '../../../nx2/public/utils/getExt.js';
2+
import { daFetch } from '../../../nx2/utils/api.js';
3+
import { DA_ORIGIN } from '../../../nx2/public/utils/constants.js';
44

55
const AEM_ORIGIN = 'https://admin.hlx.page';
66

@@ -39,7 +39,7 @@ export async function sendAction(url, label) {
3939
const path = !ext && isBulkDa(url.action) ? `${url.pathname}.html` : url.pathname;
4040
const ref = isBulkDa(url.action) ? '' : `/${url.ref}`;
4141
const aemUrl = `${origin}/${url.action}/${url.org}/${url.repo}${ref}${path}`;
42-
resp = await daFetch(aemUrl, opts);
42+
resp = await daFetch({ url: aemUrl, opts });
4343
} catch {
4444
// eslint-disable-next-line no-console
4545
console.log(`Error sending ${url.action} for ${url.href}`);

nx2/scripts/nx.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
*/
1212

1313
const LOG = async (ex, el) => (await import('../utils/error.js')).default(ex, el);
14-
const NX_BLOCKS = new Set(['importer', 'site-apps', 'hero', 'card', 'section-metadata', 'schema-editor', 'media-library', 'form', 'tree', 'permissions', 'snapshot-admin']);
14+
15+
const NX_BLOCKS = new Set(['importer', 'site-apps', 'hero', 'card', 'section-metadata', 'schema-editor', 'media-library', 'form', 'bulk', 'tree', 'permissions', 'snapshot-admin']);
1516

1617
const EW_ORIGINS = {
1718
dev: 'http://localhost:3001',

0 commit comments

Comments
 (0)