From 6c6fcac434db2cf8e8cda130b5a8932d6563e7e3 Mon Sep 17 00:00:00 2001 From: Suhani Date: Mon, 9 Sep 2024 07:51:23 +0530 Subject: [PATCH 1/9] eagerloading icons --- libs/blocks/hero-marquee/hero-marquee.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/blocks/hero-marquee/hero-marquee.js b/libs/blocks/hero-marquee/hero-marquee.js index 52faa48051..92dc26642e 100644 --- a/libs/blocks/hero-marquee/hero-marquee.js +++ b/libs/blocks/hero-marquee/hero-marquee.js @@ -132,14 +132,14 @@ function parseKeyString(str) { return result; } -function loadContentType(el, key, classes) { +async function loadContentType(el, key, classes) { if (classes !== undefined && classes.length) el.classList.add(...classes); switch (key) { case 'bgcolor': decorateBg(el); break; case 'lockup': - decorateLockupRow(el, classes); + await decorateLockupRow(el, classes); break; case 'qrcode': decorateQr(el); From 4028a50de7c582b8ec9697f869514bee32e976d2 Mon Sep 17 00:00:00 2001 From: Suhani Date: Mon, 9 Sep 2024 15:04:07 +0530 Subject: [PATCH 2/9] eagerloading icons --- libs/blocks/hero-marquee/hero-marquee.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/blocks/hero-marquee/hero-marquee.js b/libs/blocks/hero-marquee/hero-marquee.js index 92dc26642e..0a3b4aec2e 100644 --- a/libs/blocks/hero-marquee/hero-marquee.js +++ b/libs/blocks/hero-marquee/hero-marquee.js @@ -72,7 +72,7 @@ async function decorateLockupFromContent(el) { async function decorateLockupRow(el, classes) { const child = el.querySelector(':scope > div'); - await loadIconography(); + // await loadIconography(); child?.classList.add('lockup-area'); const iconSizeClass = classes?.find((c) => c.endsWith('-icon')); if (iconSizeClass) el.classList.remove(iconSizeClass); From 7e791bb55e744c9efcc0a284eaa9454325fa5540 Mon Sep 17 00:00:00 2001 From: Suhani Date: Mon, 9 Sep 2024 15:18:30 +0530 Subject: [PATCH 3/9] eagerloading icons --- libs/blocks/hero-marquee/hero-marquee.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/blocks/hero-marquee/hero-marquee.js b/libs/blocks/hero-marquee/hero-marquee.js index 0a3b4aec2e..92dc26642e 100644 --- a/libs/blocks/hero-marquee/hero-marquee.js +++ b/libs/blocks/hero-marquee/hero-marquee.js @@ -72,7 +72,7 @@ async function decorateLockupFromContent(el) { async function decorateLockupRow(el, classes) { const child = el.querySelector(':scope > div'); - // await loadIconography(); + await loadIconography(); child?.classList.add('lockup-area'); const iconSizeClass = classes?.find((c) => c.endsWith('-icon')); if (iconSizeClass) el.classList.remove(iconSizeClass); From 35656d92a5f02fff2b3658c608727dd47c1b5e6b Mon Sep 17 00:00:00 2001 From: Suhani Date: Tue, 10 Sep 2024 11:04:18 +0530 Subject: [PATCH 4/9] eagerloading icons --- libs/blocks/hero-marquee/hero-marquee.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/blocks/hero-marquee/hero-marquee.js b/libs/blocks/hero-marquee/hero-marquee.js index 92dc26642e..0e1445b69b 100644 --- a/libs/blocks/hero-marquee/hero-marquee.js +++ b/libs/blocks/hero-marquee/hero-marquee.js @@ -52,8 +52,8 @@ function decorateQr(el) { }); } -async function loadIconography() { - await new Promise((resolve) => { loadStyle(`${base}/styles/iconography.css`, resolve); }); +function loadIconography() { + return new Promise((resolve) => { loadStyle(`${base}/styles/iconography.css`, resolve); }); } async function decorateLockupFromContent(el) { From ca75372a331a47bdd995fd889e1da4eab30dce6a Mon Sep 17 00:00:00 2001 From: Suhani Date: Tue, 10 Sep 2024 11:08:00 +0530 Subject: [PATCH 5/9] eagerloading icons --- libs/blocks/hero-marquee/hero-marquee.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libs/blocks/hero-marquee/hero-marquee.js b/libs/blocks/hero-marquee/hero-marquee.js index 0e1445b69b..445ba7e497 100644 --- a/libs/blocks/hero-marquee/hero-marquee.js +++ b/libs/blocks/hero-marquee/hero-marquee.js @@ -52,8 +52,8 @@ function decorateQr(el) { }); } -function loadIconography() { - return new Promise((resolve) => { loadStyle(`${base}/styles/iconography.css`, resolve); }); +async function loadIconography() { + await new Promise((resolve) => { loadStyle(`${base}/styles/iconography.css`, resolve); }); } async function decorateLockupFromContent(el) { @@ -248,7 +248,7 @@ export default async function init(el) { firstCol.parentElement.classList.add(`row-${parsed.key}`, 'con-block'); firstCol.remove(); cols[1].classList.add('row-wrapper'); - if (contentTypes.includes(parsed.key)) loadContentType(row, parsed.key, parsed.classes); + if (contentTypes.includes(parsed.key)) await loadContentType(row, parsed.key, parsed.classes); } else { row.classList.add('norm'); decorateBlockHrs(row); From 87bba9245664384071d3881c2d7c53ca4e1a04dd Mon Sep 17 00:00:00 2001 From: Suhani Date: Tue, 10 Sep 2024 11:17:34 +0530 Subject: [PATCH 6/9] eagerloading icons --- libs/blocks/hero-marquee/hero-marquee.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libs/blocks/hero-marquee/hero-marquee.js b/libs/blocks/hero-marquee/hero-marquee.js index 445ba7e497..3284acf658 100644 --- a/libs/blocks/hero-marquee/hero-marquee.js +++ b/libs/blocks/hero-marquee/hero-marquee.js @@ -237,6 +237,7 @@ export default async function init(el) { } }); + const promiseArr = []; [...rows].forEach(async (row) => { const cols = row.querySelectorAll(':scope > div'); const firstCol = cols[0]; @@ -248,7 +249,7 @@ export default async function init(el) { firstCol.parentElement.classList.add(`row-${parsed.key}`, 'con-block'); firstCol.remove(); cols[1].classList.add('row-wrapper'); - if (contentTypes.includes(parsed.key)) await loadContentType(row, parsed.key, parsed.classes); + if (contentTypes.includes(parsed.key)) promiseArr.push(loadContentType(row, parsed.key, parsed.classes)); } else { row.classList.add('norm'); decorateBlockHrs(row); @@ -256,4 +257,5 @@ export default async function init(el) { } }); decorateTextOverrides(el, ['-heading', '-body', '-detail'], mainCopy); + await Promise.all(promiseArr); } From 77034aa8f19b0681a409283338ad787d32c8395e Mon Sep 17 00:00:00 2001 From: Suhani Date: Tue, 10 Sep 2024 19:10:56 +0530 Subject: [PATCH 7/9] eagerloading icons --- libs/blocks/hero-marquee/hero-marquee.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/libs/blocks/hero-marquee/hero-marquee.js b/libs/blocks/hero-marquee/hero-marquee.js index 3284acf658..d401054e6e 100644 --- a/libs/blocks/hero-marquee/hero-marquee.js +++ b/libs/blocks/hero-marquee/hero-marquee.js @@ -132,14 +132,14 @@ function parseKeyString(str) { return result; } -async function loadContentType(el, key, classes) { +function loadContentType(el, key, classes) { if (classes !== undefined && classes.length) el.classList.add(...classes); switch (key) { case 'bgcolor': decorateBg(el); break; case 'lockup': - await decorateLockupRow(el, classes); + decorateLockupRow(el, classes); break; case 'qrcode': decorateQr(el); @@ -237,8 +237,7 @@ export default async function init(el) { } }); - const promiseArr = []; - [...rows].forEach(async (row) => { + [...rows].forEach((row) => { const cols = row.querySelectorAll(':scope > div'); const firstCol = cols[0]; const firstColText = firstCol.textContent.toLowerCase().trim(); @@ -249,7 +248,7 @@ export default async function init(el) { firstCol.parentElement.classList.add(`row-${parsed.key}`, 'con-block'); firstCol.remove(); cols[1].classList.add('row-wrapper'); - if (contentTypes.includes(parsed.key)) promiseArr.push(loadContentType(row, parsed.key, parsed.classes)); + if (contentTypes.includes(parsed.key)) loadContentType(row, parsed.key, parsed.classes); } else { row.classList.add('norm'); decorateBlockHrs(row); @@ -257,5 +256,4 @@ export default async function init(el) { } }); decorateTextOverrides(el, ['-heading', '-body', '-detail'], mainCopy); - await Promise.all(promiseArr); } From 199f7118b0b2f93731c9c247dd50bd68e58d938b Mon Sep 17 00:00:00 2001 From: Suhani Date: Tue, 10 Sep 2024 20:00:10 +0530 Subject: [PATCH 8/9] eagerloading icons --- libs/blocks/hero-marquee/hero-marquee.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/libs/blocks/hero-marquee/hero-marquee.js b/libs/blocks/hero-marquee/hero-marquee.js index d401054e6e..3284acf658 100644 --- a/libs/blocks/hero-marquee/hero-marquee.js +++ b/libs/blocks/hero-marquee/hero-marquee.js @@ -132,14 +132,14 @@ function parseKeyString(str) { return result; } -function loadContentType(el, key, classes) { +async function loadContentType(el, key, classes) { if (classes !== undefined && classes.length) el.classList.add(...classes); switch (key) { case 'bgcolor': decorateBg(el); break; case 'lockup': - decorateLockupRow(el, classes); + await decorateLockupRow(el, classes); break; case 'qrcode': decorateQr(el); @@ -237,7 +237,8 @@ export default async function init(el) { } }); - [...rows].forEach((row) => { + const promiseArr = []; + [...rows].forEach(async (row) => { const cols = row.querySelectorAll(':scope > div'); const firstCol = cols[0]; const firstColText = firstCol.textContent.toLowerCase().trim(); @@ -248,7 +249,7 @@ export default async function init(el) { firstCol.parentElement.classList.add(`row-${parsed.key}`, 'con-block'); firstCol.remove(); cols[1].classList.add('row-wrapper'); - if (contentTypes.includes(parsed.key)) loadContentType(row, parsed.key, parsed.classes); + if (contentTypes.includes(parsed.key)) promiseArr.push(loadContentType(row, parsed.key, parsed.classes)); } else { row.classList.add('norm'); decorateBlockHrs(row); @@ -256,4 +257,5 @@ export default async function init(el) { } }); decorateTextOverrides(el, ['-heading', '-body', '-detail'], mainCopy); + await Promise.all(promiseArr); } From bc496b35464568bcc0cfb3a33957e90267d84363 Mon Sep 17 00:00:00 2001 From: Suhani Date: Wed, 11 Sep 2024 09:56:31 +0530 Subject: [PATCH 9/9] eagerloading icons --- libs/blocks/hero-marquee/hero-marquee.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libs/blocks/hero-marquee/hero-marquee.js b/libs/blocks/hero-marquee/hero-marquee.js index 3284acf658..91a0499e68 100644 --- a/libs/blocks/hero-marquee/hero-marquee.js +++ b/libs/blocks/hero-marquee/hero-marquee.js @@ -249,7 +249,9 @@ export default async function init(el) { firstCol.parentElement.classList.add(`row-${parsed.key}`, 'con-block'); firstCol.remove(); cols[1].classList.add('row-wrapper'); - if (contentTypes.includes(parsed.key)) promiseArr.push(loadContentType(row, parsed.key, parsed.classes)); + if (contentTypes.includes(parsed.key)) { + promiseArr.push(loadContentType(row, parsed.key, parsed.classes)); + } } else { row.classList.add('norm'); decorateBlockHrs(row);