Skip to content

Commit f517722

Browse files
committed
fix: upgrade to v1.2.0
2 parents ccd6983 + 8ec0ae3 commit f517722

File tree

109 files changed

+38776
-106
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

109 files changed

+38776
-106
lines changed

Diff for: .eslintignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
helix-importer-ui
1+
helix-importer-ui
2+
tools/sidekick

Diff for: .stylelintrc.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
{
2-
"extends": ["stylelint-config-standard"]
2+
"extends": [
3+
"stylelint-config-standard"
4+
],
5+
"ignoreFiles": "tools/sidekick/**/*.css"
36
}

Diff for: package-lock.json

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"description": "Starter project for Adobe Helix",
66
"scripts": {
77
"lint:js": "eslint .",
8-
"lint:css": "stylelint blocks/**/*.css styles/*.css",
8+
"lint:css": "stylelint \"blocks/**/*.css\" \"styles/*.css\" \"tools/**/*.css\"",
99
"lint": "npm run lint:js && npm run lint:css"
1010
},
1111
"repository": {
@@ -19,6 +19,7 @@
1919
},
2020
"homepage": "https://github.com/adobe/aem-boilerplate#readme",
2121
"devDependencies": {
22+
"@adobe/rum-distiller": "1.16.2",
2223
"@babel/eslint-parser": "7.24.8",
2324
"eslint": "8.57.0",
2425
"eslint-config-airbnb-base": "15.0.0",

Diff for: scripts/scripts.js

+99
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,35 @@ import {
1111
loadSections,
1212
loadCSS,
1313
sampleRUM,
14+
getMetadata,
15+
loadBlock,
16+
buildBlock,
17+
decorateBlock,
18+
loadScript,
1419
} from './aem.js';
1520

21+
/**
22+
* Helper function to create DOM elements
23+
* @param {string} tag DOM element to be created
24+
* @param {array} attributes attributes to be added
25+
*/
26+
export function createTag(tag, attributes, html) {
27+
const el = document.createElement(tag);
28+
if (html) {
29+
if (html instanceof HTMLElement || html instanceof SVGElement) {
30+
el.append(html);
31+
} else {
32+
el.insertAdjacentHTML('beforeend', html);
33+
}
34+
}
35+
if (attributes) {
36+
Object.entries(attributes).forEach(([key, val]) => {
37+
el.setAttribute(key, val);
38+
});
39+
}
40+
return el;
41+
}
42+
1643
/**
1744
* load fonts.css and set a session storage flag
1845
*/
@@ -100,6 +127,66 @@ function decorateImages(main) {
100127
});
101128
}
102129

130+
function updateGuideTemplateStyleBasedOnHero() {
131+
const isHeroContentExist = document.querySelector(
132+
'.guides-template .section.heading',
133+
);
134+
135+
if (isHeroContentExist) {
136+
document.querySelector('main').classList.add('has-full-width-hero');
137+
const cardListBlocks = document.querySelectorAll('.block.card-list');
138+
// make card list in main category page has '.image-card-listing' class
139+
cardListBlocks.forEach((block) => block.classList.add('image-card-listing'));
140+
} else {
141+
document.querySelector('main').classList.add('without-full-width-hero');
142+
}
143+
}
144+
145+
export function setUpSideNav(main, aside) {
146+
const sideNav = buildBlock('side-navigation', '');
147+
aside.append(sideNav);
148+
main.insertBefore(aside, main.querySelector('.section.content'));
149+
updateGuideTemplateStyleBasedOnHero();
150+
decorateBlock(sideNav);
151+
return loadBlock(sideNav);
152+
}
153+
154+
async function loadHighlightLibrary() {
155+
const highlightCSS = createTag('link', {
156+
rel: 'stylesheet',
157+
href: '/libs/highlight/atom-one-dark.min.css',
158+
});
159+
document.head.append(highlightCSS);
160+
161+
await loadScript('/libs/highlight/highlight.min.js');
162+
const initScript = createTag('script', {}, 'hljs.highlightAll();');
163+
document.body.append(initScript);
164+
}
165+
166+
export async function decorateGuideTemplateCodeBlock() {
167+
const firstCodeBlock = document.querySelector('pre code');
168+
if (!firstCodeBlock) return;
169+
170+
const intersectionObserver = new IntersectionObserver(
171+
(entries, observer) => {
172+
entries.forEach((entry) => {
173+
if (entry.isIntersecting) {
174+
observer.unobserve(entry.target);
175+
loadHighlightLibrary();
176+
}
177+
});
178+
},
179+
{
180+
root: null,
181+
rootMargin: '200px', // Adjust rootMargin as needed to trigger intersection at the desired position before the codeblock becomes visible
182+
threshold: 0,
183+
},
184+
);
185+
186+
// when first codeblock is coming into view, load highlight.js for page
187+
intersectionObserver.observe(firstCodeBlock);
188+
}
189+
103190
/**
104191
* Decorates the main element.
105192
* @param {Element} main The main element
@@ -158,6 +245,18 @@ async function loadLazy(doc) {
158245
loadCSS(`${window.hlx.codeBasePath}/styles/lazy-styles.css`);
159246
loadFonts();
160247
swapIcons(main);
248+
249+
if (getMetadata('supressframe')) {
250+
doc.querySelector('header').remove();
251+
doc.querySelector('footer').remove();
252+
} else {
253+
// breadcrumb setup
254+
// loadBreadcrumb(main);
255+
// sidebar + related style setup
256+
const aside = main.querySelector('main > aside');
257+
if (aside) setUpSideNav(main, aside);
258+
decorateGuideTemplateCodeBlock();
259+
}
161260
}
162261

163262
/**

Diff for: sidekick/config.schema.json

+19-1
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,19 @@
5959
},
6060
"paletteRect": {
6161
"type": "string",
62-
"description": "he dimensions and position of a palette box",
62+
"description": "The dimensions and position of a palette box",
6363
"dependentRequired": ["isPalette"]
6464
},
65+
"isPopover": {
66+
"type": "boolean",
67+
"description": "Opens the URL in a popover instead of a new tab",
68+
"dependentRequired": ["url"]
69+
},
70+
"popoverRect": {
71+
"type": "string",
72+
"description": "The dimensions of a popover, delimited by a semicolon (width, height)",
73+
"dependentRequired": ["isPopover"]
74+
},
6575
"title": {
6676
"type": "string",
6777
"description": "The button text"
@@ -204,6 +214,14 @@
204214
"specialViews": {
205215
"type": "array",
206216
"items": { "$ref": "#/$defs/specialView" }
217+
},
218+
"editUrlLabel": {
219+
"type": "string",
220+
"description": "The label of the custom editing environment."
221+
},
222+
"editUrlPattern": {
223+
"type": "string",
224+
"description": "The URL pattern for the custom editing environment. Supports placeholders like {{contentSourceUrl}} or {{pathname}}."
207225
}
208226
},
209227
"additionalProperties": false

Diff for: styles/styles.css

+155-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,13 @@ body[data-scroll='disabled'] {
9090
}
9191

9292
header {
93+
position: fixed;
94+
top: 0;
95+
width: 100%;
9396
min-height: var(--header-height);
97+
height: var(--nav-height);
98+
background-color: #fff;
99+
z-index: 9999;
94100
transition: height 0.2s, min-height 0.2s;
95101
}
96102

@@ -117,7 +123,6 @@ main {
117123

118124
/* sections */
119125
main > .section {
120-
max-width: 1200px;
121126
margin: var(--spacing-500) 0;
122127
}
123128

@@ -820,3 +825,152 @@ table+.form-field,
820825
.field-help-text p {
821826
margin: 0;
822827
}
828+
829+
/* Redesign styles */
830+
831+
832+
/* Redesign button animation */
833+
834+
/* primary button: blue bg */
835+
.redesign a.button:any-link,
836+
main .form .button,
837+
.feed.blog .read-more {
838+
cursor: pointer;
839+
text-decoration: none;
840+
padding: 5.5px 15px;
841+
text-align: center;
842+
font-size: var(--type-body-xs-size);
843+
line-height: var(--body-line-height);
844+
font-style: normal;
845+
font-weight: 600;
846+
color: var(--color-white);
847+
background: transparent;
848+
border: 2px solid var(--spectrum-blue);
849+
border-radius: 100px;
850+
white-space: nowrap;
851+
text-overflow: ellipsis;
852+
display: inline-block;
853+
position: relative;
854+
height: fit-content;
855+
transition: all 0.3s ease-in-out;
856+
overflow: hidden;
857+
transform: translateZ(0);
858+
859+
/* fix for ios overflow with border-radius not working */
860+
isolation: isolate;
861+
}
862+
863+
main .form .button {
864+
font-weight: 500;
865+
}
866+
867+
/* stylelint-disable-next-line no-descending-specificity */
868+
.redesign a.button:any-link span {
869+
color: var(--color-white);
870+
transition: all 0.3s ease-in-out;
871+
}
872+
873+
.redesign a.button:any-link:hover,
874+
main .form .button:hover,
875+
.feed.blog .read-more:hover {
876+
color: var(--spectrum-blue);
877+
border-color: var(--spectrum-blue);
878+
transform: translateZ(0);
879+
}
880+
881+
.redesign a.button:any-link:hover span {
882+
color: var(--spectrum-blue);
883+
}
884+
885+
.redesign a.button:any-link::before,
886+
main .form .button::before {
887+
content: "";
888+
position: absolute;
889+
left: -102%;
890+
top: 0;
891+
transition: all 0.3s ease-in-out;
892+
width: 202%;
893+
height: 104%;
894+
z-index: -1;
895+
896+
/* 1st value: hovered color, 2nd value: original color */
897+
background:
898+
radial-gradient(
899+
circle at left,
900+
var(--color-white) 50%,
901+
var(--spectrum-blue) 50%
902+
);
903+
}
904+
905+
.redesign a.button:any-link:hover::before,
906+
main .form .button:hover::before {
907+
left: 0%;
908+
}
909+
910+
/* secondary button: grey border transparent bg -> border button */
911+
.redesign a.button.secondary:any-link {
912+
color: var(--color-font-grey);
913+
border-color: var(--color-font-grey);
914+
}
915+
916+
.redesign a.button.secondary:any-link:hover {
917+
color: var(--color-white);
918+
}
919+
920+
.redesign a.button.secondary:any-link::before {
921+
/* 1st value: hovered color, 2nd value: original color */
922+
background:
923+
radial-gradient(
924+
circle at left,
925+
var(--color-font-grey) 50%,
926+
transparent 50%
927+
);
928+
}
929+
930+
/* .black-border button: black border transparent bg -> border button */
931+
.redesign a.button.black-border:any-link {
932+
color: var(--color-black);
933+
border-color: var(--color-black);
934+
}
935+
936+
.redesign a.button.black-border:any-link:hover {
937+
color: var(--color-white);
938+
}
939+
940+
.redesign a.button.black-border:any-link::before {
941+
/* 1st value: hovered color, 2nd value: original color */
942+
background:
943+
radial-gradient(
944+
circle at left,
945+
rgb(0 0 0 / 50%) 50%,
946+
transparent 50%
947+
);
948+
}
949+
950+
/* larger size */
951+
.redesign a.button.large:any-link {
952+
font-size: var(--type-body-s-size);
953+
line-height: var(--type-body-s-lh);
954+
}
955+
956+
@media screen and (width >= 900px) {
957+
.redesign a.button.large:any-link {
958+
font-size: var(--type-body-m-size);
959+
line-height: 1.35;
960+
padding: 8px 20px;
961+
margin-bottom: 0;
962+
}
963+
}
964+
965+
@media screen and (width >= 1200px) {
966+
.redesign a.button.large:any-link {
967+
font-size: 18px;
968+
line-height: 24px;
969+
padding: 10px 26px;
970+
}
971+
}
972+
973+
aside {
974+
min-height: 75px;
975+
padding: 8px 0 0;
976+
}

0 commit comments

Comments
 (0)