mypgs 1.3.4 → 1.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{AI_GUIDELINES.md → AGENTS.md} +18 -16
- package/README.md +8 -172
- package/assets/javascript/patterns/_header.js +77 -79
- package/assets/scss/base/_body.scss +2 -0
- package/assets/scss/base/_color.scss +2 -0
- package/assets/scss/base/_general.scss +2 -0
- package/assets/scss/base/_heading.scss +2 -0
- package/assets/scss/base/_variables.scss +2 -0
- package/assets/scss/components/_accordion.scss +2 -0
- package/assets/scss/components/_button.scss +2 -0
- package/assets/scss/components/_form.scss +2 -0
- package/assets/scss/components/_logo.scss +2 -0
- package/assets/scss/components/_menu.scss +2 -0
- package/assets/scss/components/_modals.scss +2 -0
- package/assets/scss/components/_notification.scss +2 -0
- package/assets/scss/components/_searchbar.scss +2 -0
- package/assets/scss/components/_slides.scss +2 -0
- package/assets/scss/components/_stepTabs.scss +2 -0
- package/assets/scss/components/_steps.scss +2 -0
- package/assets/scss/index.scss +32 -32
- package/assets/scss/layout/_flex.scss +2 -0
- package/assets/scss/layout/_grid.scss +2 -0
- package/assets/scss/layout/_layout.scss +2 -0
- package/assets/scss/layout/_pageShell.scss +2 -0
- package/assets/scss/mixin/_mx-base.scss +5 -2
- package/assets/scss/mixin/_mx-card.scss +5 -1
- package/assets/scss/mixin/_mx-form-addon.scss +4 -1
- package/assets/scss/mixin/_mx-form.scss +6 -3
- package/assets/scss/mixin/_mx-responsive.scss +14 -11
- package/assets/scss/mixin/_settings.scss +31 -0
- package/assets/scss/mixin/mixin.scss +11 -35
- package/assets/scss/patterns/_cookieConsent.scss +3 -1
- package/assets/scss/patterns/_footer.scss +2 -0
- package/assets/scss/patterns/_header.scss +12 -4
- package/dist/css/index.css +75 -25
- package/dist/css/index.css.map +1 -1
- package/dist/css/index.min.css +1 -1
- package/dist/javascript/index.js +77 -78
- package/dist/javascript/index.js.map +1 -1
- package/dist/javascript/index.min.js +1 -1
- package/package.json +1 -1
- package/templates/{components → html/components}/searchbar.html +1 -1
- package/templates/{patterns → html/patterns}/header.html +2 -2
- package/templates/react/components/accordion.jsx +27 -0
- package/templates/react/components/breadcumbs.jsx +27 -0
- package/templates/react/components/button.jsx +33 -0
- package/templates/react/components/card.jsx +27 -0
- package/templates/react/components/dropdown.jsx +29 -0
- package/templates/react/components/form.jsx +30 -0
- package/templates/react/components/logo.jsx +14 -0
- package/templates/react/components/menu.jsx +37 -0
- package/templates/react/components/modal.jsx +84 -0
- package/templates/react/components/notification.jsx +31 -0
- package/templates/react/components/searchbar.jsx +34 -0
- package/templates/react/components/slides.jsx +25 -0
- package/templates/react/components/stepTabs.jsx +40 -0
- package/templates/react/components/steps.jsx +21 -0
- package/templates/react/components/table.jsx +28 -0
- package/templates/react/components/tooltip.jsx +12 -0
- package/templates/react/layout/body.jsx +7 -0
- package/templates/react/layout/flex.jsx +36 -0
- package/templates/react/layout/grid.jsx +36 -0
- package/templates/react/layout/pageShell.jsx +48 -0
- package/templates/react/layout/section.jsx +44 -0
- package/templates/react/patterns/cookieConsent.jsx +62 -0
- package/templates/react/patterns/footer.jsx +40 -0
- package/templates/react/patterns/header.jsx +62 -0
- /package/templates/{components → html/components}/accordion.html +0 -0
- /package/templates/{components → html/components}/breadcumbs.html +0 -0
- /package/templates/{components → html/components}/button.html +0 -0
- /package/templates/{components → html/components}/card.html +0 -0
- /package/templates/{components → html/components}/dropdown.html +0 -0
- /package/templates/{components → html/components}/form.html +0 -0
- /package/templates/{components → html/components}/logo.html +0 -0
- /package/templates/{components → html/components}/menu.html +0 -0
- /package/templates/{components → html/components}/modal.html +0 -0
- /package/templates/{components → html/components}/notification.html +0 -0
- /package/templates/{components → html/components}/slides.html +0 -0
- /package/templates/{components → html/components}/stepTabs.html +0 -0
- /package/templates/{components → html/components}/steps.html +0 -0
- /package/templates/{components → html/components}/table.html +0 -0
- /package/templates/{components → html/components}/tooltip.html +0 -0
- /package/templates/{demo.css → html/demo.css} +0 -0
- /package/templates/{demo.html → html/demo.html} +0 -0
- /package/templates/{demo.js → html/demo.js} +0 -0
- /package/templates/{layout → html/layout}/body.html +0 -0
- /package/templates/{layout → html/layout}/flex.html +0 -0
- /package/templates/{layout → html/layout}/grid.html +0 -0
- /package/templates/{layout → html/layout}/pageShell.html +0 -0
- /package/templates/{layout → html/layout}/section.html +0 -0
- /package/templates/{patterns → html/patterns}/cookieConsent.html +0 -0
- /package/templates/{patterns → html/patterns}/footer.html +0 -0
package/dist/javascript/index.js
CHANGED
|
@@ -2349,108 +2349,112 @@ if (document.readyState === 'loading') {
|
|
|
2349
2349
|
|
|
2350
2350
|
//# HEADER
|
|
2351
2351
|
const header = pgs(document).querySelector("header");
|
|
2352
|
-
const headerElements = pgs(header).querySelectorAll("header-element");
|
|
2353
|
-
headerElements.forEach(element => PGS_header(element));
|
|
2354
2352
|
|
|
2355
2353
|
//= HEADER
|
|
2356
|
-
function PGS_header(selectHeader) {
|
|
2354
|
+
function PGS_header(selectHeader = document) {
|
|
2355
|
+
|
|
2356
|
+
if (!header) return;
|
|
2357
2357
|
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2358
|
+
const headerElements = pgs(header).querySelectorAll("header-element");
|
|
2359
|
+
|
|
2360
|
+
if (!headerElements.length) return;
|
|
2361
2361
|
|
|
2362
|
-
|
|
2363
|
-
let menuAttivate = false;
|
|
2364
|
-
let childsWidthSAVE;
|
|
2362
|
+
headerElements.forEach(selectHeader => {
|
|
2365
2363
|
|
|
2366
|
-
|
|
2364
|
+
//== ACTIVE MOBILE
|
|
2365
|
+
let menuAttivate = false;
|
|
2366
|
+
let childsWidthSAVE;
|
|
2367
2367
|
|
|
2368
|
-
|
|
2369
|
-
let style = window.getComputedStyle(headerElement);
|
|
2370
|
-
let padding = parseFloat(style.paddingLeft) + parseFloat(style.paddingRight);
|
|
2371
|
-
let gap = parseFloat(style.gap);
|
|
2372
|
-
let headerElementWidth = parseInt(headerElement.offsetWidth - padding);
|
|
2373
|
-
let childsWidth;
|
|
2368
|
+
function mobileActive(headerElement) {
|
|
2374
2369
|
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
let
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
Array.from(headerElement.children)
|
|
2382
|
-
.filter(el => !pgs(el).contains("header-element-onlyMobile"))
|
|
2383
|
-
.forEach(child => {
|
|
2384
|
-
if (pgs(child).contains("header-element-hamburger")) return;
|
|
2385
|
-
childs.push(...child.children);
|
|
2386
|
-
});
|
|
2370
|
+
//=== header
|
|
2371
|
+
let style = window.getComputedStyle(headerElement);
|
|
2372
|
+
let padding = parseFloat(style.paddingLeft) + parseFloat(style.paddingRight);
|
|
2373
|
+
let gap = parseFloat(style.gap);
|
|
2374
|
+
let headerElementWidth = parseInt(headerElement.offsetWidth - padding);
|
|
2375
|
+
let childsWidth;
|
|
2387
2376
|
|
|
2388
|
-
|
|
2389
|
-
|
|
2377
|
+
if (menuAttivate) {
|
|
2378
|
+
childsWidth = childsWidthSAVE;
|
|
2379
|
+
} else {
|
|
2380
|
+
let childs = [];
|
|
2381
|
+
|
|
2382
|
+
// Esclude l'area mobile dedicata e l'hamburger, poi misura i figli sempre visibili su desktop.
|
|
2383
|
+
Array.from(headerElement.children)
|
|
2384
|
+
.filter(el => !pgs(el).contains("header-element-onlyMobile"))
|
|
2385
|
+
.forEach(child => {
|
|
2386
|
+
if (pgs(child).contains("header-element-hamburger")) return;
|
|
2387
|
+
childs.push(...child.children);
|
|
2388
|
+
});
|
|
2390
2389
|
|
|
2391
|
-
|
|
2392
|
-
|
|
2390
|
+
gap = Math.round(gap * (childs.length - 1));
|
|
2391
|
+
let childsReduce = childs.reduce((totalWidth, child) => totalWidth + child.offsetWidth, 0) - 2;
|
|
2393
2392
|
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2393
|
+
childsWidth = childsReduce + gap;
|
|
2394
|
+
}
|
|
2395
|
+
|
|
2396
|
+
//===set data
|
|
2397
|
+
if (window.innerWidth < 600) {
|
|
2398
|
+
pgs(header).state.add("mobileActive");
|
|
2399
|
+
pgs(selectHeader).state.add("mobileActive");
|
|
2400
|
+
} else if (headerElementWidth < childsWidth) {
|
|
2401
|
+
pgs(header).state.add("mobileActive");
|
|
2402
|
+
pgs(headerElement).state.add("mobileActive");
|
|
2403
|
+
menuAttivate = true;
|
|
2404
|
+
childsWidthSAVE = childsWidth;
|
|
2405
|
+
} else {
|
|
2406
|
+
pgs(header).state.remove("mobileActive");
|
|
2407
|
+
pgs(headerElement).state.remove("mobileActive");
|
|
2408
|
+
}
|
|
2406
2409
|
}
|
|
2407
|
-
}
|
|
2408
2410
|
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2411
|
+
//== observer (throttled to avoid ResizeObserver loop warnings)
|
|
2412
|
+
let resizeRafId = 0;
|
|
2413
|
+
const scheduleMobileActive = () => {
|
|
2414
|
+
if (resizeRafId) return;
|
|
2415
|
+
resizeRafId = requestAnimationFrame(() => {
|
|
2416
|
+
resizeRafId = 0;
|
|
2417
|
+
mobileActive(selectHeader);
|
|
2418
|
+
});
|
|
2419
|
+
};
|
|
2418
2420
|
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2421
|
+
let observer = new ResizeObserver(scheduleMobileActive);
|
|
2422
|
+
observer.observe(selectHeader);
|
|
2423
|
+
scheduleMobileActive();
|
|
2424
|
+
});
|
|
2422
2425
|
|
|
2426
|
+
// Ripristina la posizione dell'header quando si esce dalla modalità mobile
|
|
2427
|
+
window.addEventListener("resize", () => {
|
|
2428
|
+
if (window.innerWidth > 768) header.style.transform = "translateY(0)";
|
|
2429
|
+
});
|
|
2423
2430
|
}
|
|
2424
|
-
|
|
2425
|
-
|
|
2431
|
+
PGS_header();
|
|
2426
2432
|
|
|
2427
2433
|
|
|
2428
2434
|
//= HEADER HEIGHT
|
|
2429
|
-
const body = document.querySelector("body");
|
|
2430
2435
|
function headerHeight() {
|
|
2431
|
-
|
|
2436
|
+
if (!header) return;
|
|
2432
2437
|
const wordPressBar = window.getComputedStyle(document.documentElement).marginTop ?? 0;
|
|
2438
|
+
const headerHeight = header.offsetHeight
|
|
2433
2439
|
|
|
2434
|
-
const
|
|
2435
|
-
|
|
2436
|
-
.reduce((sum, h) => sum + h);
|
|
2437
|
-
|
|
2438
|
-
const height = totalHeight + parseInt(wordPressBar);
|
|
2439
|
-
|
|
2440
|
-
body.style.setProperty('--heightOfHeader', `${height}px`);
|
|
2440
|
+
const body = document.querySelector("body");
|
|
2441
|
+
const height = headerHeight + parseInt(wordPressBar);
|
|
2441
2442
|
const scrollHeight = document.querySelector("header").getAttribute("data-header-scroll") === "true" ? 0 : height;
|
|
2443
|
+
body.style.setProperty('--heightOfHeader', `${height}px`);
|
|
2442
2444
|
body.style.setProperty('--heightOfHeaderScroll', `${scrollHeight}px`);
|
|
2443
|
-
|
|
2444
2445
|
}
|
|
2445
2446
|
headerHeight()
|
|
2446
2447
|
window.addEventListener("resize", headerHeight);
|
|
2447
2448
|
window.addEventListener("scroll", headerHeight);
|
|
2448
2449
|
|
|
2449
2450
|
|
|
2451
|
+
|
|
2452
|
+
|
|
2450
2453
|
//= SCROLL
|
|
2451
2454
|
// Nasconde l'header quando si scorre verso il basso e lo mostra quando si scorre verso l'alto su dispositivi con larghezza fino a 900px.
|
|
2452
2455
|
let lastScrollY = window.scrollY;
|
|
2453
2456
|
window.addEventListener("scroll", () => {
|
|
2457
|
+
if (!header) return;
|
|
2454
2458
|
let currentScrollY = window.scrollY;
|
|
2455
2459
|
|
|
2456
2460
|
if (window.innerHeight <= 900) {
|
|
@@ -2471,16 +2475,11 @@ window.addEventListener("scroll", () => {
|
|
|
2471
2475
|
|
|
2472
2476
|
});
|
|
2473
2477
|
|
|
2474
|
-
// Ripristina la posizione dell'header quando si esce dalla modalità mobile
|
|
2475
|
-
window.addEventListener("resize", () => {
|
|
2476
|
-
if (window.innerWidth > 768) header.style.transform = "translateY(0)";
|
|
2477
|
-
});
|
|
2478
2478
|
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
}
|
|
2479
|
+
|
|
2480
|
+
|
|
2481
|
+
|
|
2482
|
+
|
|
2484
2483
|
|
|
2485
2484
|
/***/ }
|
|
2486
2485
|
|