mypgs 1.5.0 → 1.6.0
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/AGENTS.md +6 -3
- package/README.md +22 -373
- package/assets/javascript/_imports.js +4 -0
- package/assets/javascript/_pgs.js +58 -0
- package/assets/javascript/base/_darkmode.js +27 -105
- package/assets/javascript/base/_svg.js +103 -0
- package/assets/javascript/components/_menu.js +1 -3
- package/assets/javascript/components/_search.js +391 -0
- package/assets/javascript/index.js +2 -0
- package/assets/javascript/layout/_header.js +26 -7
- package/assets/scss/base/_color.scss +8 -15
- package/assets/scss/base/_general.scss +36 -48
- package/assets/scss/base/_heading.scss +14 -16
- package/assets/scss/base/_variables.scss +4 -2
- package/assets/scss/components/_card.scss +10 -0
- package/assets/scss/components/_dropdown.scss +2 -1
- package/assets/scss/components/_logo.scss +2 -2
- package/assets/scss/components/_menu.scss +20 -27
- package/assets/scss/components/_modals.scss +11 -1
- package/assets/scss/components/_search.scss +134 -0
- package/assets/scss/index.scss +8 -4
- package/assets/scss/layout/_header.scss +1 -1
- package/assets/scss/layout/_pageShell.scss +1 -0
- package/dist/css/index.css +658 -620
- package/dist/css/index.css.map +1 -1
- package/dist/css/index.min.css +1 -1
- package/dist/index.d.ts +78 -0
- package/dist/javascript/index.js +904 -370
- package/dist/javascript/index.js.map +1 -1
- package/dist/javascript/index.min.js +1 -1
- package/docs/componenti-e-markup.md +90 -0
- package/docs/convenzioni.md +12 -0
- package/docs/export-e-sviluppo.md +109 -0
- package/docs/helper-javascript.md +127 -0
- package/docs/utilizzo-css-scss.md +36 -0
- package/package.json +1 -6
- package/plugins/vite-plugin-pgs.d.ts +10 -0
- package/templates/html/components/logo.html +1 -1
- package/templates/html/components/menu.html +13 -1
- package/templates/html/components/{searchbar.html → search.html} +7 -5
- package/templates/html/demo.js +1 -8
- package/templates/html/layout/header.html +11 -5
- package/templates/react/components/logo.jsx +1 -1
- package/templates/react/components/{searchbar.jsx → search.jsx} +9 -7
- package/templates/react/patterns/header.jsx +16 -10
- package/assets/scss/components/_searchbar.scss +0 -70
- package/react.d.ts +0 -11
- package/react.js +0 -1
package/dist/javascript/index.js
CHANGED
|
@@ -10,17 +10,21 @@
|
|
|
10
10
|
"use strict";
|
|
11
11
|
__webpack_require__.r(__webpack_exports__);
|
|
12
12
|
/* harmony import */ var _pgs_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_pgs.js */ "./assets/javascript/_pgs.js");
|
|
13
|
-
/* harmony import */ var
|
|
14
|
-
/* harmony import */ var
|
|
15
|
-
/* harmony import */ var
|
|
16
|
-
/* harmony import */ var
|
|
17
|
-
/* harmony import */ var
|
|
18
|
-
/* harmony import */ var
|
|
19
|
-
/* harmony import */ var
|
|
20
|
-
/* harmony import */ var
|
|
21
|
-
/* harmony import */ var
|
|
22
|
-
/* harmony import */ var
|
|
23
|
-
/* harmony import */ var
|
|
13
|
+
/* harmony import */ var _base_svg_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./base/_svg.js */ "./assets/javascript/base/_svg.js");
|
|
14
|
+
/* harmony import */ var _components_accordion_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./components/_accordion.js */ "./assets/javascript/components/_accordion.js");
|
|
15
|
+
/* harmony import */ var _components_dropdown_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./components/_dropdown.js */ "./assets/javascript/components/_dropdown.js");
|
|
16
|
+
/* harmony import */ var _components_menu_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./components/_menu.js */ "./assets/javascript/components/_menu.js");
|
|
17
|
+
/* harmony import */ var _components_modals_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./components/_modals.js */ "./assets/javascript/components/_modals.js");
|
|
18
|
+
/* harmony import */ var _components_notifications_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./components/_notifications.js */ "./assets/javascript/components/_notifications.js");
|
|
19
|
+
/* harmony import */ var _components_search_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./components/_search.js */ "./assets/javascript/components/_search.js");
|
|
20
|
+
/* harmony import */ var _components_slides_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./components/_slides.js */ "./assets/javascript/components/_slides.js");
|
|
21
|
+
/* harmony import */ var _components_stepTabs_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./components/_stepTabs.js */ "./assets/javascript/components/_stepTabs.js");
|
|
22
|
+
/* harmony import */ var _components_steps_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./components/_steps.js */ "./assets/javascript/components/_steps.js");
|
|
23
|
+
/* harmony import */ var _components_summary_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./components/_summary.js */ "./assets/javascript/components/_summary.js");
|
|
24
|
+
/* harmony import */ var _functions_formValidate_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./functions/_formValidate.js */ "./assets/javascript/functions/_formValidate.js");
|
|
25
|
+
/* harmony import */ var _functions_scrollY_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./functions/_scrollY.js */ "./assets/javascript/functions/_scrollY.js");
|
|
26
|
+
|
|
27
|
+
|
|
24
28
|
|
|
25
29
|
|
|
26
30
|
|
|
@@ -36,17 +40,19 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
36
40
|
|
|
37
41
|
|
|
38
42
|
_pgs_js__WEBPACK_IMPORTED_MODULE_0__.pgs.registerModules({
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
43
|
+
svg: _base_svg_js__WEBPACK_IMPORTED_MODULE_1__.PGS_svg,
|
|
44
|
+
accordion: _components_accordion_js__WEBPACK_IMPORTED_MODULE_2__.PGS_accordion,
|
|
45
|
+
dropdown: _components_dropdown_js__WEBPACK_IMPORTED_MODULE_3__.PGS_dropdown,
|
|
46
|
+
menu: _components_menu_js__WEBPACK_IMPORTED_MODULE_4__.PGS_menu,
|
|
47
|
+
modal: _components_modals_js__WEBPACK_IMPORTED_MODULE_5__.PGS_modal,
|
|
48
|
+
notification: _components_notifications_js__WEBPACK_IMPORTED_MODULE_6__.PGS_notification,
|
|
49
|
+
search: _components_search_js__WEBPACK_IMPORTED_MODULE_7__.PGS_search,
|
|
50
|
+
slides: _components_slides_js__WEBPACK_IMPORTED_MODULE_8__.PGS_slides,
|
|
51
|
+
stepTabs: _components_stepTabs_js__WEBPACK_IMPORTED_MODULE_9__.PGS_stepTabs,
|
|
52
|
+
steps: _components_steps_js__WEBPACK_IMPORTED_MODULE_10__.PGS_steps,
|
|
53
|
+
summary: _components_summary_js__WEBPACK_IMPORTED_MODULE_11__.PGS_summary,
|
|
54
|
+
formValidate: _functions_formValidate_js__WEBPACK_IMPORTED_MODULE_12__.PGS_formValidate,
|
|
55
|
+
scrollHorizontal: _functions_scrollY_js__WEBPACK_IMPORTED_MODULE_13__.PGS_scrollHorizontal,
|
|
50
56
|
});
|
|
51
57
|
|
|
52
58
|
|
|
@@ -250,10 +256,56 @@ function pgs(root) {
|
|
|
250
256
|
function createOption(attribute) {
|
|
251
257
|
if (!canAttr) return undefined;
|
|
252
258
|
|
|
259
|
+
const read = () => (root.getAttribute(attribute) || "").match(/[^\s[\]]+(?:\[[^\]]*\])?/g) || [];
|
|
260
|
+
const write = values => root.setAttribute(attribute, values.join(" "));
|
|
261
|
+
const getKey = value => String(value).trim().match(/^[^\s[\]]+/)?.[0] || "";
|
|
262
|
+
const getValues = values => values
|
|
263
|
+
.flat()
|
|
264
|
+
.flatMap(value => String(value).match(/[^\s[\]]+(?:\[[^\]]*\])?/g) || [])
|
|
265
|
+
.filter(Boolean);
|
|
266
|
+
|
|
253
267
|
function api() {
|
|
254
268
|
return api;
|
|
255
269
|
}
|
|
256
270
|
|
|
271
|
+
api.add = function (...values) {
|
|
272
|
+
const current = read();
|
|
273
|
+
|
|
274
|
+
getValues(values).forEach(value => {
|
|
275
|
+
if (!current.includes(value)) current.push(value);
|
|
276
|
+
});
|
|
277
|
+
|
|
278
|
+
write(current);
|
|
279
|
+
return api;
|
|
280
|
+
};
|
|
281
|
+
|
|
282
|
+
api.remove = function (...values) {
|
|
283
|
+
const keys = getValues(values).map(getKey).filter(Boolean);
|
|
284
|
+
write(read().filter(value => !keys.includes(getKey(value))));
|
|
285
|
+
return api;
|
|
286
|
+
};
|
|
287
|
+
|
|
288
|
+
api.toggle = function (value, force) {
|
|
289
|
+
const key = getKey(value);
|
|
290
|
+
if (!key) return false;
|
|
291
|
+
|
|
292
|
+
const exists = api.contains(key);
|
|
293
|
+
|
|
294
|
+
if (force !== undefined) {
|
|
295
|
+
if (force && !exists) api.add(value);
|
|
296
|
+
if (!force && exists) api.remove(key);
|
|
297
|
+
return !!force;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
if (exists) {
|
|
301
|
+
api.remove(key);
|
|
302
|
+
return false;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
api.add(value);
|
|
306
|
+
return true;
|
|
307
|
+
};
|
|
308
|
+
|
|
257
309
|
api.contains = function (key) {
|
|
258
310
|
const source = root.getAttribute(attribute) || "";
|
|
259
311
|
const safeKey = String(key).replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
@@ -273,6 +325,18 @@ function pgs(root) {
|
|
|
273
325
|
return match ? match[1] : undefined;
|
|
274
326
|
};
|
|
275
327
|
|
|
328
|
+
api.setValueBrackets = function (key, value = "") {
|
|
329
|
+
const optionKey = getKey(key);
|
|
330
|
+
if (!optionKey) return api;
|
|
331
|
+
|
|
332
|
+
const option = `${optionKey}[${String(value).trim()}]`;
|
|
333
|
+
const options = read().filter(item => getKey(item) !== optionKey);
|
|
334
|
+
|
|
335
|
+
options.push(option);
|
|
336
|
+
write(options);
|
|
337
|
+
return api;
|
|
338
|
+
};
|
|
339
|
+
|
|
276
340
|
Object.defineProperty(api, "value", {
|
|
277
341
|
get() { return root.getAttribute(attribute); },
|
|
278
342
|
set(v) { root.setAttribute(attribute, v); }
|
|
@@ -355,124 +419,46 @@ globalThis.pgs ??= pgs;
|
|
|
355
419
|
|
|
356
420
|
//# DARKMODE
|
|
357
421
|
|
|
422
|
+
const EVENT_SVG_CHANGE_COLOR = "pgs:svg:changeColor";
|
|
358
423
|
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
for (let I = 0; I < 20; I++) {
|
|
365
|
-
const color = ROOT.getPropertyValue('--' + type + '-color-' + I).toLocaleLowerCase().split("&");
|
|
366
|
-
if (!color[0] == "" && !color[1] == "") {
|
|
367
|
-
let lightDark = [color[0], color[1]]
|
|
368
|
-
colors.push(lightDark)
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
return colors;
|
|
372
|
-
}
|
|
373
|
-
const colors_svg_lottie = [searchColor("svg"), searchColor("lottie")];
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
//+ change COLORS
|
|
377
|
-
function darkmodeColorSVG() {
|
|
378
|
-
function changecolor(svgDoc, type = "svg") {
|
|
379
|
-
let isDarkMode = (document.documentElement.getAttribute("data-darkmode") === "true") ? false : true;
|
|
380
|
-
|
|
381
|
-
svgDoc.querySelectorAll('[fill], [stroke]').forEach(fillStroke => {
|
|
382
|
-
|
|
383
|
-
for (const colors of colors_svg_lottie) {
|
|
384
|
-
for (const color of colors) {
|
|
385
|
-
let OLD = (color[0] || '').replace(/\s/g, '');
|
|
386
|
-
let NEW = (color[1] || '').replace(/\s/g, '');
|
|
387
|
-
|
|
388
|
-
["fill", "stroke"].forEach(attr => {
|
|
389
|
-
const current = fillStroke.getAttribute(attr);
|
|
390
|
-
|
|
391
|
-
fillStroke.style.transition = "fill 0.5s ease, stroke 0.5s ease";
|
|
392
|
-
|
|
393
|
-
if (!isDarkMode) {
|
|
394
|
-
if (current == OLD) fillStroke.setAttribute(attr, NEW)
|
|
395
|
-
} else {
|
|
396
|
-
if (current == NEW) fillStroke.setAttribute(attr, OLD)
|
|
397
|
-
}
|
|
398
|
-
});
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
});
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
//== OBJECTS
|
|
405
|
-
const objects = document.querySelectorAll('object[type="image/svg+xml"]');
|
|
406
|
-
objects.forEach(obj => {
|
|
407
|
-
|
|
408
|
-
//=== ALL FILL / STROKE
|
|
409
|
-
obj.addEventListener("load", () => {
|
|
410
|
-
const svgDoc = obj.contentDocument;
|
|
411
|
-
if (svgDoc) changecolor(svgDoc, "svg")
|
|
412
|
-
});
|
|
413
|
-
|
|
414
|
-
//=== In caso l'object sia già caricato
|
|
415
|
-
if (obj.contentDocument) {
|
|
416
|
-
const event = new Event("load");
|
|
417
|
-
obj.dispatchEvent(event);
|
|
418
|
-
}
|
|
419
|
-
});
|
|
420
|
-
|
|
421
|
-
//== LOTTIE
|
|
422
|
-
const lottiePlayers = document.querySelectorAll('lottie-player');
|
|
423
|
-
lottiePlayers.forEach(lottiePlayer => {
|
|
424
|
-
|
|
425
|
-
//=== ALL FILL / STROKE
|
|
426
|
-
lottiePlayer.addEventListener("load", () => {
|
|
427
|
-
const svg = lottiePlayer.shadowRoot.querySelector('svg');
|
|
428
|
-
if (svg) changecolor(svg, "lottie")
|
|
429
|
-
});
|
|
424
|
+
//+ CHANGE ICON
|
|
425
|
+
function changeIcon(selector, isDarkMode) {
|
|
426
|
+
selector.forEach(button => {
|
|
427
|
+
const ICON = button.querySelector("i");
|
|
428
|
+
if (!ICON) return;
|
|
430
429
|
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
const event = new Event("load");
|
|
434
|
-
lottiePlayer.dispatchEvent(event);
|
|
435
|
-
}
|
|
430
|
+
ICON.classList.toggle("fa-moon", !isDarkMode);
|
|
431
|
+
ICON.classList.toggle("fa-sun", isDarkMode);
|
|
436
432
|
});
|
|
437
433
|
}
|
|
438
434
|
|
|
435
|
+
//+ SET STATUS
|
|
436
|
+
function setDarkmodeStatus(toggle = false, button) {
|
|
437
|
+
let isDarkMode = localStorage.getItem("screenIsDarkMode") === "true";
|
|
439
438
|
|
|
439
|
+
if (toggle) {
|
|
440
|
+
isDarkMode = !isDarkMode;
|
|
441
|
+
localStorage.setItem("screenIsDarkMode", isDarkMode);
|
|
442
|
+
}
|
|
440
443
|
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
document.body.classList.add("darkmode");
|
|
446
|
-
document.querySelector(":root").setAttribute("data-darkmode", "true");
|
|
447
|
-
document.body.setAttribute("data-darkmode", "true");
|
|
448
|
-
}
|
|
444
|
+
// SET
|
|
445
|
+
pgs(document.documentElement).state.toggle("darkmode", isDarkMode);
|
|
446
|
+
pgs(document.body).state.toggle("darkmode", isDarkMode);
|
|
447
|
+
// END SET
|
|
449
448
|
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
const ICON = button.querySelector("i");
|
|
453
|
-
if (!ICON) return;
|
|
454
|
-
ICON.classList.toggle("fa-moon", !isDarkMode);
|
|
455
|
-
ICON.classList.toggle("fa-sun", isDarkMode);
|
|
456
|
-
});
|
|
457
|
-
darkmodeColorSVG();
|
|
449
|
+
changeIcon(button, isDarkMode);
|
|
450
|
+
document.dispatchEvent(new CustomEvent(EVENT_SVG_CHANGE_COLOR, { detail: { isDarkMode } }));
|
|
458
451
|
}
|
|
459
452
|
|
|
460
|
-
toggleDarkmode.forEach(button => {
|
|
461
453
|
|
|
462
|
-
//== EXECUTE IMMEDIATELY
|
|
463
|
-
let isDarkMode = document.documentElement.getAttribute("data-darkmode") === "true";
|
|
464
|
-
change(toggleDarkmode, isDarkMode);
|
|
465
454
|
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
localStorage.setItem("screenIsDarkMode", isDarkMode);
|
|
455
|
+
//= INIT
|
|
456
|
+
const toggleDarkmode = pgs(document).querySelectorAll("toggleDarkmode");
|
|
457
|
+
setDarkmodeStatus(false, toggleDarkmode);
|
|
470
458
|
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
change(toggleDarkmode, isDarkMode);
|
|
475
|
-
});
|
|
459
|
+
//= BUTTON DARKMODE
|
|
460
|
+
toggleDarkmode.forEach(button => {
|
|
461
|
+
button.addEventListener("click", () => setDarkmodeStatus(true, toggleDarkmode));
|
|
476
462
|
});
|
|
477
463
|
|
|
478
464
|
|
|
@@ -528,6 +514,124 @@ document.addEventListener('DOMContentLoaded', () => {
|
|
|
528
514
|
});
|
|
529
515
|
|
|
530
516
|
|
|
517
|
+
/***/ },
|
|
518
|
+
|
|
519
|
+
/***/ "./assets/javascript/base/_svg.js"
|
|
520
|
+
/*!****************************************!*\
|
|
521
|
+
!*** ./assets/javascript/base/_svg.js ***!
|
|
522
|
+
\****************************************/
|
|
523
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
524
|
+
|
|
525
|
+
"use strict";
|
|
526
|
+
__webpack_require__.r(__webpack_exports__);
|
|
527
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
528
|
+
/* harmony export */ PGS_svg: () => (/* binding */ PGS_svg)
|
|
529
|
+
/* harmony export */ });
|
|
530
|
+
//# SVG & LOTTIE COLORS
|
|
531
|
+
|
|
532
|
+
const svgColors = {
|
|
533
|
+
eventChangeColor: "pgs:svg:changeColor",
|
|
534
|
+
watchedObjects: new WeakSet(),
|
|
535
|
+
watchedLotties: new WeakSet(),
|
|
536
|
+
|
|
537
|
+
_normalizeColor: (color = "") => {
|
|
538
|
+
return color.replace(/\s/g, "").toLocaleLowerCase();
|
|
539
|
+
},
|
|
540
|
+
|
|
541
|
+
_getCurrentDarkmode: () => {
|
|
542
|
+
return pgs(document.documentElement).state.contains("darkmode");
|
|
543
|
+
},
|
|
544
|
+
|
|
545
|
+
searchColor(type = "svg") {
|
|
546
|
+
const ROOT = getComputedStyle(document.documentElement);
|
|
547
|
+
const colors = [];
|
|
548
|
+
|
|
549
|
+
for (let I = 0; I < 20; I++) {
|
|
550
|
+
const color = ROOT.getPropertyValue("--" + type + "-color-" + I).toLocaleLowerCase().split("&").map(value => value.trim());
|
|
551
|
+
if (color[0] && color[1]) colors.push([color[0], color[1]]);
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
return colors;
|
|
555
|
+
},
|
|
556
|
+
|
|
557
|
+
_changeColor(svgDoc, isDarkMode, colors) {
|
|
558
|
+
if (!svgDoc) return;
|
|
559
|
+
|
|
560
|
+
svgDoc.querySelectorAll("[fill], [stroke]").forEach(fillStroke => {
|
|
561
|
+
for (const color of colors) {
|
|
562
|
+
const OLD = svgColors._normalizeColor(color[0]);
|
|
563
|
+
const NEW = svgColors._normalizeColor(color[1]);
|
|
564
|
+
|
|
565
|
+
["fill", "stroke"].forEach(attr => {
|
|
566
|
+
const current = svgColors._normalizeColor(fillStroke.getAttribute(attr) || "");
|
|
567
|
+
if (!current) return;
|
|
568
|
+
|
|
569
|
+
fillStroke.style.transition = "fill 0.5s ease, stroke 0.5s ease";
|
|
570
|
+
|
|
571
|
+
if (isDarkMode && current === OLD) fillStroke.setAttribute(attr, NEW);
|
|
572
|
+
if (!isDarkMode && current === NEW) fillStroke.setAttribute(attr, OLD);
|
|
573
|
+
});
|
|
574
|
+
}
|
|
575
|
+
});
|
|
576
|
+
},
|
|
577
|
+
|
|
578
|
+
_getLottieSvg(lottiePlayer) {
|
|
579
|
+
return lottiePlayer.shadowRoot?.querySelector("svg") || null;
|
|
580
|
+
},
|
|
581
|
+
|
|
582
|
+
init() {
|
|
583
|
+
document.addEventListener(svgColors.eventChangeColor, event => {
|
|
584
|
+
svgColors.applyColorsSVG(event.detail?.isDarkMode ?? svgColors._getCurrentDarkmode());
|
|
585
|
+
svgColors.applyColorsLottie(event.detail?.isDarkMode ?? svgColors._getCurrentDarkmode());
|
|
586
|
+
});
|
|
587
|
+
|
|
588
|
+
document.addEventListener("DOMContentLoaded", () => {
|
|
589
|
+
svgColors.applyColorsSVG();
|
|
590
|
+
svgColors.applyColorsLottie();
|
|
591
|
+
});
|
|
592
|
+
},
|
|
593
|
+
|
|
594
|
+
applyColorsSVG(isDarkMode = svgColors._getCurrentDarkmode()) {
|
|
595
|
+
const colorsSvg = svgColors.searchColor("svg");
|
|
596
|
+
|
|
597
|
+
if (!pgs(document).querySelector("svgChangeColor")) return;
|
|
598
|
+
|
|
599
|
+
document.querySelectorAll('object[type="image/svg+xml"]').forEach(obj => {
|
|
600
|
+
if (!svgColors.watchedObjects.has(obj)) {
|
|
601
|
+
obj.addEventListener("load", () => svgColors._changeColor(obj.contentDocument, svgColors._getCurrentDarkmode(), svgColors.searchColor("svg")));
|
|
602
|
+
svgColors.watchedObjects.add(obj);
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
if (obj.contentDocument) svgColors._changeColor(obj.contentDocument, isDarkMode, colorsSvg);
|
|
606
|
+
});
|
|
607
|
+
|
|
608
|
+
},
|
|
609
|
+
|
|
610
|
+
applyColorsLottie(isDarkMode = svgColors._getCurrentDarkmode()) {
|
|
611
|
+
const colorsLottie = svgColors.searchColor("svg");
|
|
612
|
+
|
|
613
|
+
if (!pgs(document).querySelector("lottieChangeColor")) return;
|
|
614
|
+
|
|
615
|
+
document.querySelectorAll("lottie-player").forEach(lottiePlayer => {
|
|
616
|
+
if (!svgColors.watchedLotties.has(lottiePlayer)) {
|
|
617
|
+
lottiePlayer.addEventListener("load", () => svgColors._changeColor(svgColors._getLottieSvg(lottiePlayer), svgColors._getCurrentDarkmode(), svgColors.searchColor("svg")));
|
|
618
|
+
svgColors.watchedLotties.add(lottiePlayer);
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
if (lottiePlayer.shadowRoot) svgColors._changeColor(svgColors._getLottieSvg(lottiePlayer), isDarkMode, colorsLottie);
|
|
622
|
+
});
|
|
623
|
+
},
|
|
624
|
+
};
|
|
625
|
+
|
|
626
|
+
svgColors.init();
|
|
627
|
+
|
|
628
|
+
const PGS_svg = {
|
|
629
|
+
eventChangeColor: svgColors.eventChangeColor,
|
|
630
|
+
applyColorsSVG: isDarkMode => svgColors.applyColorsSVG(isDarkMode),
|
|
631
|
+
applyColorsLottie: isDarkMode => svgColors.applyColorsLottie(isDarkMode),
|
|
632
|
+
};
|
|
633
|
+
|
|
634
|
+
|
|
531
635
|
/***/ },
|
|
532
636
|
|
|
533
637
|
/***/ "./assets/javascript/components/_accordion.js"
|
|
@@ -930,6 +1034,7 @@ function PGS_menu_init(root = document) {
|
|
|
930
1034
|
li.querySelector("a").insertAdjacentElement("afterend", button);
|
|
931
1035
|
|
|
932
1036
|
pgs(li).add("dropdown")
|
|
1037
|
+
pgs(li).option.setValueBrackets("position", "bottom right")
|
|
933
1038
|
pgs(button).add("dropdown-button")
|
|
934
1039
|
pgs(button).add("buttonNohover")
|
|
935
1040
|
pgs(ul).add("dropdown-content")
|
|
@@ -940,9 +1045,6 @@ function PGS_menu_init(root = document) {
|
|
|
940
1045
|
API.set(MENU, {
|
|
941
1046
|
element: MENU,
|
|
942
1047
|
type: "horizontal",
|
|
943
|
-
// items: () => Array.from(MENU.querySelectorAll('nav > ul > li')),
|
|
944
|
-
// submenus: () => Array.from(MENU.querySelectorAll('.menu-item-has-children > ul')),
|
|
945
|
-
// dropdowns: () => Array.from(MENU.querySelectorAll('.menu-item-has-children')).map(PGS_dropdown_api).filter(Boolean),
|
|
946
1048
|
refresh: () => {
|
|
947
1049
|
PGS_menu_init(MENU.parentNode || document);
|
|
948
1050
|
return API.get(MENU);
|
|
@@ -1327,120 +1429,527 @@ else PGS_notificationTrigger_init();
|
|
|
1327
1429
|
|
|
1328
1430
|
/***/ },
|
|
1329
1431
|
|
|
1330
|
-
/***/ "./assets/javascript/components/
|
|
1432
|
+
/***/ "./assets/javascript/components/_search.js"
|
|
1331
1433
|
/*!*************************************************!*\
|
|
1332
|
-
!*** ./assets/javascript/components/
|
|
1434
|
+
!*** ./assets/javascript/components/_search.js ***!
|
|
1333
1435
|
\*************************************************/
|
|
1334
1436
|
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1335
1437
|
|
|
1336
1438
|
"use strict";
|
|
1337
1439
|
__webpack_require__.r(__webpack_exports__);
|
|
1338
1440
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1339
|
-
/* harmony export */
|
|
1340
|
-
/* harmony export */
|
|
1341
|
-
/* harmony export */ PGS_slides_init: () => (/* binding */ PGS_slides_init)
|
|
1441
|
+
/* harmony export */ PGS_search: () => (/* binding */ PGS_search),
|
|
1442
|
+
/* harmony export */ PGS_search_api: () => (/* binding */ PGS_search_api)
|
|
1342
1443
|
/* harmony export */ });
|
|
1343
|
-
/* harmony import */ var _functions_scrollY__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../functions/_scrollY */ "./assets/javascript/functions/_scrollY.js");
|
|
1344
|
-
|
|
1345
1444
|
const API = new WeakMap();
|
|
1445
|
+
const OPEN_SEARCHES = new Set();
|
|
1446
|
+
let searchId = 0;
|
|
1447
|
+
|
|
1448
|
+
const DEFAULT_OPTIONS = {
|
|
1449
|
+
minLength: 2,
|
|
1450
|
+
debounce: 200,
|
|
1451
|
+
limit: 8,
|
|
1452
|
+
submitOnSelect: false,
|
|
1453
|
+
searchOnFocus: true,
|
|
1454
|
+
source: null,
|
|
1455
|
+
onSelect: null,
|
|
1456
|
+
};
|
|
1346
1457
|
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
this.viewRatio = viewRatio;
|
|
1458
|
+
function nextSearchId() {
|
|
1459
|
+
searchId += 1;
|
|
1460
|
+
return searchId;
|
|
1461
|
+
}
|
|
1352
1462
|
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1463
|
+
function getSearches(root) {
|
|
1464
|
+
const searches = root instanceof Element && pgs(root).contains("search") ? [root] : [];
|
|
1465
|
+
searches.push(...pgs(root).querySelectorAll("search"));
|
|
1466
|
+
return searches;
|
|
1467
|
+
}
|
|
1358
1468
|
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
block: "nearest",
|
|
1363
|
-
container: "nearest",
|
|
1364
|
-
...scrollOptions,
|
|
1365
|
-
};
|
|
1469
|
+
function directPgsChild(element, token) {
|
|
1470
|
+
return Array.from(element.children).find(child => pgs(child).contains(token));
|
|
1471
|
+
}
|
|
1366
1472
|
|
|
1367
|
-
|
|
1473
|
+
function normalizeItem(item) {
|
|
1474
|
+
if (typeof item === "string" || typeof item === "number") {
|
|
1475
|
+
const value = String(item).trim();
|
|
1476
|
+
return value ? { label: value, value, disabled: false, data: item } : null;
|
|
1368
1477
|
}
|
|
1369
|
-
|
|
1370
|
-
//+ CREATE BUTTON
|
|
1371
|
-
#createButtonsAndDots() {
|
|
1372
|
-
const EL = this.selector
|
|
1373
1478
|
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1479
|
+
if (!item || typeof item !== "object") return null;
|
|
1480
|
+
|
|
1481
|
+
const label = String(item.label ?? item.value ?? "").trim();
|
|
1482
|
+
if (!label) return null;
|
|
1483
|
+
|
|
1484
|
+
return {
|
|
1485
|
+
label,
|
|
1486
|
+
value: String(item.value ?? label),
|
|
1487
|
+
disabled: Boolean(item.disabled),
|
|
1488
|
+
data: Object.prototype.hasOwnProperty.call(item, "data") ? item.data : item,
|
|
1489
|
+
};
|
|
1490
|
+
}
|
|
1491
|
+
|
|
1492
|
+
function normalizeOptions(current, options = {}) {
|
|
1493
|
+
const next = { ...current, ...options };
|
|
1494
|
+
next.minLength = Math.max(0, Number.parseInt(next.minLength, 10) || 0);
|
|
1495
|
+
next.debounce = Math.max(0, Number.parseInt(next.debounce, 10) || 0);
|
|
1496
|
+
next.limit = Math.max(1, Number.parseInt(next.limit, 10) || DEFAULT_OPTIONS.limit);
|
|
1497
|
+
next.submitOnSelect = Boolean(next.submitOnSelect);
|
|
1498
|
+
next.searchOnFocus = Boolean(next.searchOnFocus);
|
|
1499
|
+
next.source = typeof next.source === "function" || Array.isArray(next.source) ? next.source : null;
|
|
1500
|
+
next.onSelect = typeof next.onSelect === "function" ? next.onSelect : null;
|
|
1501
|
+
return next;
|
|
1502
|
+
}
|
|
1503
|
+
|
|
1504
|
+
function closeSearch(search) {
|
|
1505
|
+
const data = API.get(search);
|
|
1506
|
+
if (!data) return;
|
|
1507
|
+
|
|
1508
|
+
pgs(search).state.remove("open");
|
|
1509
|
+
data.input.setAttribute("aria-expanded", "false");
|
|
1510
|
+
data.input.removeAttribute("aria-activedescendant");
|
|
1511
|
+
data.list.setAttribute("aria-hidden", "true");
|
|
1512
|
+
data.setActiveIndex(-1);
|
|
1513
|
+
OPEN_SEARCHES.delete(search);
|
|
1514
|
+
}
|
|
1515
|
+
|
|
1516
|
+
function openSearch(search) {
|
|
1517
|
+
const data = API.get(search);
|
|
1518
|
+
if (!data || data.items().length === 0) return;
|
|
1519
|
+
|
|
1520
|
+
pgs(search).state.add("open");
|
|
1521
|
+
data.input.setAttribute("aria-expanded", "true");
|
|
1522
|
+
data.list.setAttribute("aria-hidden", "false");
|
|
1523
|
+
OPEN_SEARCHES.add(search);
|
|
1524
|
+
}
|
|
1525
|
+
|
|
1526
|
+
function PGS_search_init(root = document) {
|
|
1527
|
+
getSearches(root).forEach(search => {
|
|
1528
|
+
if (API.has(search)) return;
|
|
1529
|
+
|
|
1530
|
+
const input = search.querySelector('input[type="search"]');
|
|
1531
|
+
const list = directPgsChild(search, "search-suggestions");
|
|
1532
|
+
if (!input || !list) return;
|
|
1533
|
+
|
|
1534
|
+
const id = nextSearchId();
|
|
1535
|
+
if (!input.id) input.id = `search-input-${id}`;
|
|
1536
|
+
if (!list.id) list.id = `search-suggestions-${id}`;
|
|
1537
|
+
|
|
1538
|
+
input.setAttribute("role", "combobox");
|
|
1539
|
+
input.setAttribute("aria-autocomplete", "list");
|
|
1540
|
+
input.setAttribute("aria-haspopup", "listbox");
|
|
1541
|
+
input.setAttribute("aria-controls", list.id);
|
|
1542
|
+
input.setAttribute("aria-expanded", "false");
|
|
1543
|
+
input.setAttribute("autocomplete", "off");
|
|
1544
|
+
list.setAttribute("role", "listbox");
|
|
1545
|
+
list.setAttribute("aria-labelledby", input.id);
|
|
1546
|
+
list.setAttribute("aria-hidden", "true");
|
|
1547
|
+
|
|
1548
|
+
|
|
1549
|
+
let options = { ...DEFAULT_OPTIONS };
|
|
1550
|
+
let items = [];
|
|
1551
|
+
let activeIndex = -1;
|
|
1552
|
+
let timer = null;
|
|
1553
|
+
let controller = null;
|
|
1554
|
+
let requestNumber = 0;
|
|
1555
|
+
|
|
1556
|
+
function setLoading(loading) {
|
|
1557
|
+
pgs(search).state.toggle("loading", loading);
|
|
1558
|
+
input.setAttribute("aria-busy", String(loading));
|
|
1378
1559
|
}
|
|
1379
1560
|
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1561
|
+
function setActiveIndex(index) {
|
|
1562
|
+
activeIndex = index;
|
|
1563
|
+
const elements = Array.from(list.querySelectorAll('[pgs~="search-suggestions-item"]'));
|
|
1383
1564
|
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1565
|
+
elements.forEach((element, itemIndex) => {
|
|
1566
|
+
const selected = itemIndex === activeIndex;
|
|
1567
|
+
element.setAttribute("aria-selected", String(selected));
|
|
1568
|
+
pgs(element).state.toggle("selected", selected);
|
|
1387
1569
|
});
|
|
1570
|
+
|
|
1571
|
+
const active = elements[activeIndex];
|
|
1572
|
+
if (active) {
|
|
1573
|
+
input.setAttribute("aria-activedescendant", active.id);
|
|
1574
|
+
active.scrollIntoView({ block: "nearest" });
|
|
1575
|
+
} else {
|
|
1576
|
+
input.removeAttribute("aria-activedescendant");
|
|
1577
|
+
}
|
|
1388
1578
|
}
|
|
1389
|
-
}
|
|
1390
1579
|
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
const currents = this.container.querySelectorAll('.view');
|
|
1394
|
-
let current;
|
|
1395
|
-
|
|
1580
|
+
function moveActive(step) {
|
|
1581
|
+
if (!items.length) return;
|
|
1396
1582
|
|
|
1397
|
-
|
|
1398
|
-
|
|
1583
|
+
let next = activeIndex;
|
|
1584
|
+
for (let checked = 0; checked < items.length; checked += 1) {
|
|
1585
|
+
next = (next + step + items.length) % items.length;
|
|
1586
|
+
if (!items[next].disabled) {
|
|
1587
|
+
setActiveIndex(next);
|
|
1588
|
+
return;
|
|
1589
|
+
}
|
|
1590
|
+
}
|
|
1591
|
+
}
|
|
1399
1592
|
|
|
1400
|
-
|
|
1593
|
+
function clear() {
|
|
1594
|
+
items = [];
|
|
1595
|
+
activeIndex = -1;
|
|
1596
|
+
list.replaceChildren();
|
|
1597
|
+
closeSearch(search);
|
|
1598
|
+
}
|
|
1401
1599
|
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1600
|
+
function cancel() {
|
|
1601
|
+
if (timer !== null) window.clearTimeout(timer);
|
|
1602
|
+
timer = null;
|
|
1603
|
+
if (controller) controller.abort();
|
|
1604
|
+
controller = null;
|
|
1605
|
+
requestNumber += 1;
|
|
1606
|
+
setLoading(false);
|
|
1607
|
+
}
|
|
1405
1608
|
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1609
|
+
function render(nextItems) {
|
|
1610
|
+
items = Array.from(nextItems || [])
|
|
1611
|
+
.map(normalizeItem)
|
|
1612
|
+
.filter(Boolean)
|
|
1613
|
+
.slice(0, options.limit);
|
|
1614
|
+
|
|
1615
|
+
const fragment = document.createDocumentFragment();
|
|
1616
|
+
items.forEach((item, index) => {
|
|
1617
|
+
const option = document.createElement("li");
|
|
1618
|
+
pgs(option).add("search-suggestions-item");
|
|
1619
|
+
pgs(option).add("flexRow");
|
|
1620
|
+
option.id = `${list.id}-option-${index}`;
|
|
1621
|
+
option.dataset.index = String(index);
|
|
1622
|
+
option.setAttribute("role", "option");
|
|
1623
|
+
option.setAttribute("aria-selected", "false");
|
|
1624
|
+
option.setAttribute("aria-disabled", String(item.disabled));
|
|
1625
|
+
option.innerHTML = '<i class="fa-solid fa-magnifying-glass"></i>' + item.label;
|
|
1626
|
+
fragment.append(option);
|
|
1410
1627
|
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
if (pgs(this.selector).option.contains('singleScroll')) current = currents[0];
|
|
1414
|
-
else current = currents[currents.length - 1];
|
|
1415
|
-
|
|
1416
|
-
const next = current?.nextElementSibling;
|
|
1417
|
-
console.log(current, next);
|
|
1628
|
+
});
|
|
1418
1629
|
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1630
|
+
activeIndex = -1;
|
|
1631
|
+
list.replaceChildren(fragment);
|
|
1632
|
+
pgs(search).state.remove("error");
|
|
1422
1633
|
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
this.container.children[index].scrollIntoView(this.scrollOptions)
|
|
1426
|
-
}
|
|
1634
|
+
if (items.length) openSearch(search);
|
|
1635
|
+
else closeSearch(search);
|
|
1427
1636
|
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
allLi.forEach(LI => {
|
|
1431
|
-
const visiblePercent = 0.9 + LI.intersectionRatio * 0.1;
|
|
1432
|
-
const isView = visiblePercent >= 0.98;
|
|
1637
|
+
return items;
|
|
1638
|
+
}
|
|
1433
1639
|
|
|
1434
|
-
|
|
1435
|
-
if (
|
|
1436
|
-
|
|
1437
|
-
|
|
1640
|
+
async function resolveSource(query, signal) {
|
|
1641
|
+
if (Array.isArray(options.source)) {
|
|
1642
|
+
const normalizedQuery = query.toLocaleLowerCase();
|
|
1643
|
+
return options.source.filter(item => {
|
|
1644
|
+
const normalized = normalizeItem(item);
|
|
1645
|
+
return normalized && normalized.label.toLocaleLowerCase().includes(normalizedQuery);
|
|
1646
|
+
});
|
|
1647
|
+
}
|
|
1438
1648
|
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1649
|
+
if (typeof options.source !== "function") return [];
|
|
1650
|
+
return await options.source({
|
|
1651
|
+
query,
|
|
1652
|
+
signal,
|
|
1653
|
+
limit: options.limit,
|
|
1654
|
+
element: search,
|
|
1655
|
+
input,
|
|
1656
|
+
});
|
|
1657
|
+
}
|
|
1442
1658
|
|
|
1443
|
-
|
|
1659
|
+
async function runSearch(query = input.value) {
|
|
1660
|
+
cancel();
|
|
1661
|
+
clear();
|
|
1662
|
+
|
|
1663
|
+
const normalizedQuery = String(query ?? "").trim();
|
|
1664
|
+
if (normalizedQuery.length < options.minLength || !options.source) return [];
|
|
1665
|
+
|
|
1666
|
+
const currentRequest = requestNumber;
|
|
1667
|
+
controller = new AbortController();
|
|
1668
|
+
const currentController = controller;
|
|
1669
|
+
setLoading(true);
|
|
1670
|
+
|
|
1671
|
+
try {
|
|
1672
|
+
const result = await resolveSource(normalizedQuery, currentController.signal);
|
|
1673
|
+
if (currentRequest !== requestNumber || currentController.signal.aborted) return [];
|
|
1674
|
+
return render(result);
|
|
1675
|
+
} catch (error) {
|
|
1676
|
+
if (error?.name === "AbortError") return [];
|
|
1677
|
+
if (currentRequest !== requestNumber) return [];
|
|
1678
|
+
|
|
1679
|
+
clear();
|
|
1680
|
+
pgs(search).state.add("error");
|
|
1681
|
+
search.dispatchEvent(new CustomEvent("pgs:search:error", {
|
|
1682
|
+
bubbles: true,
|
|
1683
|
+
detail: { error, query: normalizedQuery },
|
|
1684
|
+
}));
|
|
1685
|
+
return [];
|
|
1686
|
+
} finally {
|
|
1687
|
+
if (controller === currentController) controller = null;
|
|
1688
|
+
if (currentRequest === requestNumber) setLoading(false);
|
|
1689
|
+
}
|
|
1690
|
+
}
|
|
1691
|
+
|
|
1692
|
+
function schedule() {
|
|
1693
|
+
cancel();
|
|
1694
|
+
clear();
|
|
1695
|
+
pgs(search).state.remove("error");
|
|
1696
|
+
|
|
1697
|
+
if (input.value.trim().length < options.minLength || !options.source) return;
|
|
1698
|
+
timer = window.setTimeout(() => {
|
|
1699
|
+
timer = null;
|
|
1700
|
+
runSearch(input.value);
|
|
1701
|
+
}, options.debounce);
|
|
1702
|
+
}
|
|
1703
|
+
|
|
1704
|
+
function select(index = activeIndex, submit = options.submitOnSelect) {
|
|
1705
|
+
const item = items[index];
|
|
1706
|
+
if (!item || item.disabled) return null;
|
|
1707
|
+
|
|
1708
|
+
input.value = item.value;
|
|
1709
|
+
cancel();
|
|
1710
|
+
clear();
|
|
1711
|
+
|
|
1712
|
+
const detail = { item, index, value: item.value, input, element: search };
|
|
1713
|
+
search.dispatchEvent(new CustomEvent("pgs:search:select", { bubbles: true, detail }));
|
|
1714
|
+
options.onSelect?.(detail);
|
|
1715
|
+
|
|
1716
|
+
input.focus();
|
|
1717
|
+
if (submit && typeof search.requestSubmit === "function") search.requestSubmit();
|
|
1718
|
+
return item;
|
|
1719
|
+
}
|
|
1720
|
+
|
|
1721
|
+
function configure(nextOptions = {}) {
|
|
1722
|
+
options = normalizeOptions(options, nextOptions);
|
|
1723
|
+
return api;
|
|
1724
|
+
}
|
|
1725
|
+
|
|
1726
|
+
function onInput() {
|
|
1727
|
+
schedule();
|
|
1728
|
+
}
|
|
1729
|
+
|
|
1730
|
+
function onFocus() {
|
|
1731
|
+
if (items.length) openSearch(search);
|
|
1732
|
+
else if (options.searchOnFocus) schedule();
|
|
1733
|
+
}
|
|
1734
|
+
|
|
1735
|
+
function onKeydown(event) {
|
|
1736
|
+
if (event.key === "ArrowDown") {
|
|
1737
|
+
if (!pgs(search).state.contains("open")) schedule();
|
|
1738
|
+
if (items.length) {
|
|
1739
|
+
event.preventDefault();
|
|
1740
|
+
moveActive(1);
|
|
1741
|
+
}
|
|
1742
|
+
return;
|
|
1743
|
+
}
|
|
1744
|
+
|
|
1745
|
+
if (event.key === "ArrowUp" && items.length) {
|
|
1746
|
+
event.preventDefault();
|
|
1747
|
+
moveActive(-1);
|
|
1748
|
+
return;
|
|
1749
|
+
}
|
|
1750
|
+
|
|
1751
|
+
if (event.key === "Enter" && activeIndex >= 0) {
|
|
1752
|
+
event.preventDefault();
|
|
1753
|
+
select(activeIndex);
|
|
1754
|
+
return;
|
|
1755
|
+
}
|
|
1756
|
+
|
|
1757
|
+
if (event.key === "Escape") {
|
|
1758
|
+
event.preventDefault();
|
|
1759
|
+
cancel();
|
|
1760
|
+
closeSearch(search);
|
|
1761
|
+
return;
|
|
1762
|
+
}
|
|
1763
|
+
|
|
1764
|
+
if (event.key === "Tab") closeSearch(search);
|
|
1765
|
+
}
|
|
1766
|
+
|
|
1767
|
+
function onListPointerDown(event) {
|
|
1768
|
+
const option = event.target.closest('[pgs~="search-suggestions-item"]');
|
|
1769
|
+
if (!option || !list.contains(option)) return;
|
|
1770
|
+
event.preventDefault();
|
|
1771
|
+
select(Number.parseInt(option.dataset.index, 10));
|
|
1772
|
+
}
|
|
1773
|
+
|
|
1774
|
+
function onSubmit() {
|
|
1775
|
+
cancel();
|
|
1776
|
+
closeSearch(search);
|
|
1777
|
+
}
|
|
1778
|
+
|
|
1779
|
+
function destroy() {
|
|
1780
|
+
cancel();
|
|
1781
|
+
clear();
|
|
1782
|
+
input.removeEventListener("input", onInput);
|
|
1783
|
+
input.removeEventListener("focus", onFocus);
|
|
1784
|
+
input.removeEventListener("keydown", onKeydown);
|
|
1785
|
+
list.removeEventListener("pointerdown", onListPointerDown);
|
|
1786
|
+
search.removeEventListener("submit", onSubmit);
|
|
1787
|
+
API.delete(search);
|
|
1788
|
+
}
|
|
1789
|
+
|
|
1790
|
+
const api = {
|
|
1791
|
+
element: search,
|
|
1792
|
+
input,
|
|
1793
|
+
list,
|
|
1794
|
+
configure,
|
|
1795
|
+
setSource: source => configure({ source }),
|
|
1796
|
+
search: runSearch,
|
|
1797
|
+
open: () => openSearch(search),
|
|
1798
|
+
close: () => closeSearch(search),
|
|
1799
|
+
clear,
|
|
1800
|
+
cancel,
|
|
1801
|
+
select,
|
|
1802
|
+
refresh: () => runSearch(input.value),
|
|
1803
|
+
destroy,
|
|
1804
|
+
items: () => [...items],
|
|
1805
|
+
isOpen: () => pgs(search).state.contains("open"),
|
|
1806
|
+
isLoading: () => pgs(search).state.contains("loading"),
|
|
1807
|
+
setActiveIndex,
|
|
1808
|
+
};
|
|
1809
|
+
|
|
1810
|
+
input.addEventListener("input", onInput);
|
|
1811
|
+
input.addEventListener("focus", onFocus);
|
|
1812
|
+
input.addEventListener("keydown", onKeydown);
|
|
1813
|
+
list.addEventListener("pointerdown", onListPointerDown);
|
|
1814
|
+
search.addEventListener("submit", onSubmit);
|
|
1815
|
+
API.set(search, api);
|
|
1816
|
+
});
|
|
1817
|
+
}
|
|
1818
|
+
|
|
1819
|
+
document.addEventListener("pointerdown", event => {
|
|
1820
|
+
OPEN_SEARCHES.forEach(search => {
|
|
1821
|
+
if (!search.contains(event.target)) closeSearch(search);
|
|
1822
|
+
});
|
|
1823
|
+
});
|
|
1824
|
+
|
|
1825
|
+
PGS_search_init();
|
|
1826
|
+
|
|
1827
|
+
function PGS_search_api(selector) {
|
|
1828
|
+
return API.get(selector);
|
|
1829
|
+
}
|
|
1830
|
+
|
|
1831
|
+
const PGS_search = {
|
|
1832
|
+
init: PGS_search_init,
|
|
1833
|
+
api: PGS_search_api,
|
|
1834
|
+
};
|
|
1835
|
+
|
|
1836
|
+
|
|
1837
|
+
/***/ },
|
|
1838
|
+
|
|
1839
|
+
/***/ "./assets/javascript/components/_slides.js"
|
|
1840
|
+
/*!*************************************************!*\
|
|
1841
|
+
!*** ./assets/javascript/components/_slides.js ***!
|
|
1842
|
+
\*************************************************/
|
|
1843
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1844
|
+
|
|
1845
|
+
"use strict";
|
|
1846
|
+
__webpack_require__.r(__webpack_exports__);
|
|
1847
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1848
|
+
/* harmony export */ PGS_slides: () => (/* binding */ PGS_slides),
|
|
1849
|
+
/* harmony export */ PGS_slides_api: () => (/* binding */ PGS_slides_api),
|
|
1850
|
+
/* harmony export */ PGS_slides_init: () => (/* binding */ PGS_slides_init)
|
|
1851
|
+
/* harmony export */ });
|
|
1852
|
+
/* harmony import */ var _functions_scrollY__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../functions/_scrollY */ "./assets/javascript/functions/_scrollY.js");
|
|
1853
|
+
|
|
1854
|
+
const API = new WeakMap();
|
|
1855
|
+
|
|
1856
|
+
class PGS_Slides {
|
|
1857
|
+
//- CONSTRUCTOR
|
|
1858
|
+
constructor({ selector, viewRatio = 0.97, optionIntersectionObserver = {}, scrollOptions = {} } = {}) {
|
|
1859
|
+
this.selector = selector;
|
|
1860
|
+
this.viewRatio = viewRatio;
|
|
1861
|
+
|
|
1862
|
+
this.optionIntersectionObserver = {
|
|
1863
|
+
threshold: Array.from({ length: 101 }, (_, i) => i / 100), // 0%,1%,2%...100%
|
|
1864
|
+
rootMargin: "0px",
|
|
1865
|
+
...optionIntersectionObserver,
|
|
1866
|
+
};
|
|
1867
|
+
|
|
1868
|
+
this.scrollOptions = {
|
|
1869
|
+
behavior: "smooth",
|
|
1870
|
+
inline: "center",
|
|
1871
|
+
block: "nearest",
|
|
1872
|
+
container: "nearest",
|
|
1873
|
+
...scrollOptions,
|
|
1874
|
+
};
|
|
1875
|
+
|
|
1876
|
+
this.container = this.selector ? pgs(this.selector).querySelector("slides-container") : null;
|
|
1877
|
+
}
|
|
1878
|
+
|
|
1879
|
+
//+ CREATE BUTTON
|
|
1880
|
+
#createButtonsAndDots() {
|
|
1881
|
+
const EL = this.selector
|
|
1882
|
+
|
|
1883
|
+
//== PULSANTI
|
|
1884
|
+
if (!pgs(EL).querySelector('slides-prec') && !pgs(EL).querySelector('slides-next')) {
|
|
1885
|
+
EL.insertAdjacentHTML("afterbegin", `<button pgs="slides-prec buttonIcon" type="button" class="precButton" aria-label="slide precedente"> <span> <i class="fa-solid fa-arrow-left"></i></span></button>`);
|
|
1886
|
+
EL.insertAdjacentHTML("beforeend", `<button pgs="slides-next buttonIcon" type="button" class="nextButton" aria-label="prossima slide"> <span> <i class="fa-solid fa-arrow-right"></i></span></button>`);
|
|
1887
|
+
}
|
|
1888
|
+
|
|
1889
|
+
//== DOTS
|
|
1890
|
+
if (!pgs(EL).querySelector('slides-dots')) {
|
|
1891
|
+
EL.insertAdjacentHTML("beforeend", `<div pgs="slides-dots" class="slides-dots"></div>`);
|
|
1892
|
+
|
|
1893
|
+
Array.from(this.container.children).forEach(() => {
|
|
1894
|
+
pgs(EL).querySelector('slides-dots')
|
|
1895
|
+
.insertAdjacentHTML("beforeend", `<button type="button" class="slide-dot" aria-label="vai alla prossima slide"></button>`);
|
|
1896
|
+
});
|
|
1897
|
+
}
|
|
1898
|
+
}
|
|
1899
|
+
|
|
1900
|
+
//+ PREV
|
|
1901
|
+
#previousSlide() {
|
|
1902
|
+
const currents = this.container.querySelectorAll('.view');
|
|
1903
|
+
let current;
|
|
1904
|
+
|
|
1905
|
+
|
|
1906
|
+
if (pgs(this.selector).option.contains('singleScroll')) current = currents[currents.length - 1];
|
|
1907
|
+
else current = currents[0];
|
|
1908
|
+
|
|
1909
|
+
const prev = current?.previousElementSibling;
|
|
1910
|
+
|
|
1911
|
+
prev?.scrollIntoView(this.scrollOptions);
|
|
1912
|
+
prev?.focus({ preventScroll: true });
|
|
1913
|
+
}
|
|
1914
|
+
|
|
1915
|
+
//+ NEXT
|
|
1916
|
+
#nextSlide() {
|
|
1917
|
+
const currents = this.container.querySelectorAll('.view');
|
|
1918
|
+
let current;
|
|
1919
|
+
|
|
1920
|
+
|
|
1921
|
+
|
|
1922
|
+
if (pgs(this.selector).option.contains('singleScroll')) current = currents[0];
|
|
1923
|
+
else current = currents[currents.length - 1];
|
|
1924
|
+
|
|
1925
|
+
const next = current?.nextElementSibling;
|
|
1926
|
+
console.log(current, next);
|
|
1927
|
+
|
|
1928
|
+
next?.scrollIntoView(this.scrollOptions);
|
|
1929
|
+
next?.focus({ preventScroll: true });
|
|
1930
|
+
}
|
|
1931
|
+
|
|
1932
|
+
//+ GO TO NUMBER SLIDE
|
|
1933
|
+
#goToNumberSlide(index) {
|
|
1934
|
+
this.container.children[index].scrollIntoView(this.scrollOptions)
|
|
1935
|
+
}
|
|
1936
|
+
|
|
1937
|
+
//+ CALLBACK
|
|
1938
|
+
#callback(allLi, container, precButton, nextButton, dots) {
|
|
1939
|
+
allLi.forEach(LI => {
|
|
1940
|
+
const visiblePercent = 0.9 + LI.intersectionRatio * 0.1;
|
|
1941
|
+
const isView = visiblePercent >= 0.98;
|
|
1942
|
+
|
|
1943
|
+
//== SCROLL ANIMATION
|
|
1944
|
+
if (!pgs(LI.target).option.contains('notScrollAnimation') && LI.target.firstElementChild) {
|
|
1945
|
+
LI.target.firstElementChild.style.setProperty('--visible-percent', `${visiblePercent}`);
|
|
1946
|
+
};
|
|
1947
|
+
|
|
1948
|
+
//== VIEW & NOT-VIEW
|
|
1949
|
+
LI.target.classList.toggle("view", isView);
|
|
1950
|
+
LI.target.classList.toggle("notView", !isView);
|
|
1951
|
+
|
|
1952
|
+
//== VIEW PREC e NEXT
|
|
1444
1953
|
const all = LI.target.parentNode.children;
|
|
1445
1954
|
const atStart = all[0].classList.contains("view");
|
|
1446
1955
|
const atEnd = all[all.length - 1].classList.contains("view");
|
|
@@ -2238,6 +2747,166 @@ function PGS_scrollHorizontal(querySelector, dataSpeed) {
|
|
|
2238
2747
|
}
|
|
2239
2748
|
|
|
2240
2749
|
|
|
2750
|
+
/***/ },
|
|
2751
|
+
|
|
2752
|
+
/***/ "./assets/javascript/layout/_header.js"
|
|
2753
|
+
/*!*********************************************!*\
|
|
2754
|
+
!*** ./assets/javascript/layout/_header.js ***!
|
|
2755
|
+
\*********************************************/
|
|
2756
|
+
() {
|
|
2757
|
+
|
|
2758
|
+
//# HEADER
|
|
2759
|
+
const header = pgs(document).querySelector("header");
|
|
2760
|
+
|
|
2761
|
+
//= HEADER
|
|
2762
|
+
function PGS_header(selectHeader = document) {
|
|
2763
|
+
|
|
2764
|
+
if (!header) return;
|
|
2765
|
+
|
|
2766
|
+
const headerElements = pgs(header).querySelectorAll("header-element");
|
|
2767
|
+
|
|
2768
|
+
if (!headerElements.length) return;
|
|
2769
|
+
|
|
2770
|
+
headerElements.forEach(selectHeader => {
|
|
2771
|
+
|
|
2772
|
+
//== ACTIVE MOBILE
|
|
2773
|
+
let menuAttivate = false;
|
|
2774
|
+
let childsWidthSAVE;
|
|
2775
|
+
|
|
2776
|
+
function mobileActive(headerElement) {
|
|
2777
|
+
|
|
2778
|
+
//=== header
|
|
2779
|
+
let style = window.getComputedStyle(headerElement);
|
|
2780
|
+
let padding = parseFloat(style.paddingLeft) + parseFloat(style.paddingRight);
|
|
2781
|
+
let gap = parseFloat(style.gap);
|
|
2782
|
+
let headerElementWidth = parseInt(headerElement.offsetWidth - padding);
|
|
2783
|
+
let childsWidth;
|
|
2784
|
+
|
|
2785
|
+
if (menuAttivate) {
|
|
2786
|
+
childsWidth = childsWidthSAVE;
|
|
2787
|
+
} else {
|
|
2788
|
+
let childs = [];
|
|
2789
|
+
|
|
2790
|
+
// Esclude l'area mobile dedicata e l'hamburger, poi misura i figli sempre visibili su desktop.
|
|
2791
|
+
Array.from(headerElement.children)
|
|
2792
|
+
.filter(el => !pgs(el).contains("header-element-onlyMobile"))
|
|
2793
|
+
.forEach(child => {
|
|
2794
|
+
if (pgs(child).contains("header-element-hamburger")) return;
|
|
2795
|
+
childs.push(...child.children);
|
|
2796
|
+
});
|
|
2797
|
+
|
|
2798
|
+
gap = Math.round(gap * (childs.length - 1));
|
|
2799
|
+
let childsReduce = childs.reduce((totalWidth, child) => totalWidth + child.offsetWidth, 0) - 2;
|
|
2800
|
+
|
|
2801
|
+
childsWidth = childsReduce + gap;
|
|
2802
|
+
}
|
|
2803
|
+
|
|
2804
|
+
//===set data
|
|
2805
|
+
if (window.innerWidth < 600) {
|
|
2806
|
+
pgs(header).state.add("mobileActive");
|
|
2807
|
+
pgs(selectHeader).state.add("mobileActive");
|
|
2808
|
+
} else if (headerElementWidth < childsWidth) {
|
|
2809
|
+
pgs(header).state.add("mobileActive");
|
|
2810
|
+
pgs(headerElement).state.add("mobileActive");
|
|
2811
|
+
menuAttivate = true;
|
|
2812
|
+
childsWidthSAVE = childsWidth;
|
|
2813
|
+
} else {
|
|
2814
|
+
pgs(header).state.remove("mobileActive");
|
|
2815
|
+
pgs(headerElement).state.remove("mobileActive");
|
|
2816
|
+
}
|
|
2817
|
+
}
|
|
2818
|
+
|
|
2819
|
+
//== observer (throttled to avoid ResizeObserver loop warnings)
|
|
2820
|
+
let resizeRafId = 0;
|
|
2821
|
+
const scheduleMobileActive = () => {
|
|
2822
|
+
if (resizeRafId) return;
|
|
2823
|
+
resizeRafId = requestAnimationFrame(() => {
|
|
2824
|
+
resizeRafId = 0;
|
|
2825
|
+
mobileActive(selectHeader);
|
|
2826
|
+
});
|
|
2827
|
+
};
|
|
2828
|
+
|
|
2829
|
+
let observer = new ResizeObserver(scheduleMobileActive);
|
|
2830
|
+
observer.observe(selectHeader);
|
|
2831
|
+
scheduleMobileActive();
|
|
2832
|
+
});
|
|
2833
|
+
|
|
2834
|
+
// Ripristina la posizione dell'header quando si esce dalla modalità mobile
|
|
2835
|
+
window.addEventListener("resize", () => {
|
|
2836
|
+
if (window.innerWidth > 768) header.style.transform = "translateY(0)";
|
|
2837
|
+
});
|
|
2838
|
+
}
|
|
2839
|
+
PGS_header();
|
|
2840
|
+
|
|
2841
|
+
|
|
2842
|
+
//= HEADER HEIGHT
|
|
2843
|
+
function headerHeight() {
|
|
2844
|
+
if (!header) return;
|
|
2845
|
+
const wordPressBar = window.getComputedStyle(document.documentElement).marginTop ?? 0;
|
|
2846
|
+
const headerHeight = header.offsetHeight
|
|
2847
|
+
const height = headerHeight + parseInt(wordPressBar);
|
|
2848
|
+
const scrollHeight = document.querySelector("header").getAttribute("data-header-scroll") === "true" ? 0 : height;
|
|
2849
|
+
|
|
2850
|
+
document.documentElement.style.setProperty("--heightOfHeader", `${height}px`);
|
|
2851
|
+
document.documentElement.style.setProperty("--heightOfHeaderScroll", `${scrollHeight}px`);
|
|
2852
|
+
}
|
|
2853
|
+
|
|
2854
|
+
// Il modulo può essere caricato nel footer: rimanda il primo calcolo al frame
|
|
2855
|
+
// successivo, quando il browser ha già composto l'header, senza aspettare il
|
|
2856
|
+
// caricamento completo della pagina.
|
|
2857
|
+
let headerHeightRafId = 0;
|
|
2858
|
+
function scheduleHeaderHeight() {
|
|
2859
|
+
if (headerHeightRafId) return;
|
|
2860
|
+
|
|
2861
|
+
headerHeightRafId = requestAnimationFrame(() => {
|
|
2862
|
+
headerHeightRafId = 0;
|
|
2863
|
+
headerHeight();
|
|
2864
|
+
});
|
|
2865
|
+
}
|
|
2866
|
+
|
|
2867
|
+
if (header) {
|
|
2868
|
+
const headerHeightObserver = new ResizeObserver(scheduleHeaderHeight);
|
|
2869
|
+
headerHeightObserver.observe(header);
|
|
2870
|
+
|
|
2871
|
+
// Un font web può modificare la larghezza del menu e quindi l'altezza
|
|
2872
|
+
// dell'header, anche dopo il primo frame.
|
|
2873
|
+
document.fonts?.ready?.then(scheduleHeaderHeight);
|
|
2874
|
+
}
|
|
2875
|
+
|
|
2876
|
+
scheduleHeaderHeight();
|
|
2877
|
+
window.addEventListener("resize", scheduleHeaderHeight);
|
|
2878
|
+
window.addEventListener("scroll", scheduleHeaderHeight, { passive: true });
|
|
2879
|
+
|
|
2880
|
+
|
|
2881
|
+
|
|
2882
|
+
|
|
2883
|
+
//= SCROLL
|
|
2884
|
+
// 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.
|
|
2885
|
+
let lastScrollY = window.scrollY;
|
|
2886
|
+
window.addEventListener("scroll", () => {
|
|
2887
|
+
if (!header) return;
|
|
2888
|
+
let currentScrollY = window.scrollY;
|
|
2889
|
+
|
|
2890
|
+
if (window.innerHeight <= 900) {
|
|
2891
|
+
if (currentScrollY >= 80) {
|
|
2892
|
+
if (currentScrollY > lastScrollY) {
|
|
2893
|
+
header.style.transform = "translateY(-100%)";
|
|
2894
|
+
header.setAttribute("data-header-scroll", true)
|
|
2895
|
+
} else {
|
|
2896
|
+
header.style.transform = "translateY(0px)";
|
|
2897
|
+
header.setAttribute("data-header-scroll", false)
|
|
2898
|
+
}
|
|
2899
|
+
} else {
|
|
2900
|
+
header.style.transform = "translateY(0)"; // Mostra sempre l'header se il scroll è inferiore a 80px
|
|
2901
|
+
header.setAttribute("data-header-scroll", false)
|
|
2902
|
+
}
|
|
2903
|
+
}
|
|
2904
|
+
lastScrollY = currentScrollY;
|
|
2905
|
+
|
|
2906
|
+
});
|
|
2907
|
+
|
|
2908
|
+
|
|
2909
|
+
|
|
2241
2910
|
/***/ },
|
|
2242
2911
|
|
|
2243
2912
|
/***/ "./assets/javascript/patterns/_cookieConsent.js"
|
|
@@ -2463,147 +3132,6 @@ if (document.readyState === 'loading') {
|
|
|
2463
3132
|
}
|
|
2464
3133
|
|
|
2465
3134
|
|
|
2466
|
-
/***/ },
|
|
2467
|
-
|
|
2468
|
-
/***/ "./assets/javascript/patterns/_header.js"
|
|
2469
|
-
/*!***********************************************!*\
|
|
2470
|
-
!*** ./assets/javascript/patterns/_header.js ***!
|
|
2471
|
-
\***********************************************/
|
|
2472
|
-
() {
|
|
2473
|
-
|
|
2474
|
-
//# HEADER
|
|
2475
|
-
const header = pgs(document).querySelector("header");
|
|
2476
|
-
|
|
2477
|
-
//= HEADER
|
|
2478
|
-
function PGS_header(selectHeader = document) {
|
|
2479
|
-
|
|
2480
|
-
if (!header) return;
|
|
2481
|
-
|
|
2482
|
-
const headerElements = pgs(header).querySelectorAll("header-element");
|
|
2483
|
-
|
|
2484
|
-
if (!headerElements.length) return;
|
|
2485
|
-
|
|
2486
|
-
headerElements.forEach(selectHeader => {
|
|
2487
|
-
|
|
2488
|
-
//== ACTIVE MOBILE
|
|
2489
|
-
let menuAttivate = false;
|
|
2490
|
-
let childsWidthSAVE;
|
|
2491
|
-
|
|
2492
|
-
function mobileActive(headerElement) {
|
|
2493
|
-
|
|
2494
|
-
//=== header
|
|
2495
|
-
let style = window.getComputedStyle(headerElement);
|
|
2496
|
-
let padding = parseFloat(style.paddingLeft) + parseFloat(style.paddingRight);
|
|
2497
|
-
let gap = parseFloat(style.gap);
|
|
2498
|
-
let headerElementWidth = parseInt(headerElement.offsetWidth - padding);
|
|
2499
|
-
let childsWidth;
|
|
2500
|
-
|
|
2501
|
-
if (menuAttivate) {
|
|
2502
|
-
childsWidth = childsWidthSAVE;
|
|
2503
|
-
} else {
|
|
2504
|
-
let childs = [];
|
|
2505
|
-
|
|
2506
|
-
// Esclude l'area mobile dedicata e l'hamburger, poi misura i figli sempre visibili su desktop.
|
|
2507
|
-
Array.from(headerElement.children)
|
|
2508
|
-
.filter(el => !pgs(el).contains("header-element-onlyMobile"))
|
|
2509
|
-
.forEach(child => {
|
|
2510
|
-
if (pgs(child).contains("header-element-hamburger")) return;
|
|
2511
|
-
childs.push(...child.children);
|
|
2512
|
-
});
|
|
2513
|
-
|
|
2514
|
-
gap = Math.round(gap * (childs.length - 1));
|
|
2515
|
-
let childsReduce = childs.reduce((totalWidth, child) => totalWidth + child.offsetWidth, 0) - 2;
|
|
2516
|
-
|
|
2517
|
-
childsWidth = childsReduce + gap;
|
|
2518
|
-
}
|
|
2519
|
-
|
|
2520
|
-
//===set data
|
|
2521
|
-
if (window.innerWidth < 600) {
|
|
2522
|
-
pgs(header).state.add("mobileActive");
|
|
2523
|
-
pgs(selectHeader).state.add("mobileActive");
|
|
2524
|
-
} else if (headerElementWidth < childsWidth) {
|
|
2525
|
-
pgs(header).state.add("mobileActive");
|
|
2526
|
-
pgs(headerElement).state.add("mobileActive");
|
|
2527
|
-
menuAttivate = true;
|
|
2528
|
-
childsWidthSAVE = childsWidth;
|
|
2529
|
-
} else {
|
|
2530
|
-
pgs(header).state.remove("mobileActive");
|
|
2531
|
-
pgs(headerElement).state.remove("mobileActive");
|
|
2532
|
-
}
|
|
2533
|
-
}
|
|
2534
|
-
|
|
2535
|
-
//== observer (throttled to avoid ResizeObserver loop warnings)
|
|
2536
|
-
let resizeRafId = 0;
|
|
2537
|
-
const scheduleMobileActive = () => {
|
|
2538
|
-
if (resizeRafId) return;
|
|
2539
|
-
resizeRafId = requestAnimationFrame(() => {
|
|
2540
|
-
resizeRafId = 0;
|
|
2541
|
-
mobileActive(selectHeader);
|
|
2542
|
-
});
|
|
2543
|
-
};
|
|
2544
|
-
|
|
2545
|
-
let observer = new ResizeObserver(scheduleMobileActive);
|
|
2546
|
-
observer.observe(selectHeader);
|
|
2547
|
-
scheduleMobileActive();
|
|
2548
|
-
});
|
|
2549
|
-
|
|
2550
|
-
// Ripristina la posizione dell'header quando si esce dalla modalità mobile
|
|
2551
|
-
window.addEventListener("resize", () => {
|
|
2552
|
-
if (window.innerWidth > 768) header.style.transform = "translateY(0)";
|
|
2553
|
-
});
|
|
2554
|
-
}
|
|
2555
|
-
PGS_header();
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
//= HEADER HEIGHT
|
|
2559
|
-
function headerHeight() {
|
|
2560
|
-
if (!header) return;
|
|
2561
|
-
const wordPressBar = window.getComputedStyle(document.documentElement).marginTop ?? 0;
|
|
2562
|
-
const headerHeight = header.offsetHeight
|
|
2563
|
-
const height = headerHeight + parseInt(wordPressBar);
|
|
2564
|
-
const scrollHeight = document.querySelector("header").getAttribute("data-header-scroll") === "true" ? 0 : height;
|
|
2565
|
-
|
|
2566
|
-
document.documentElement.style.setProperty("--heightOfHeader", `${height}px`);
|
|
2567
|
-
document.documentElement.style.setProperty("--heightOfHeaderScroll", `${scrollHeight}px`);
|
|
2568
|
-
}
|
|
2569
|
-
headerHeight()
|
|
2570
|
-
window.addEventListener("resize", headerHeight);
|
|
2571
|
-
window.addEventListener("scroll", headerHeight);
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
//= SCROLL
|
|
2577
|
-
// 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.
|
|
2578
|
-
let lastScrollY = window.scrollY;
|
|
2579
|
-
window.addEventListener("scroll", () => {
|
|
2580
|
-
if (!header) return;
|
|
2581
|
-
let currentScrollY = window.scrollY;
|
|
2582
|
-
|
|
2583
|
-
if (window.innerHeight <= 900) {
|
|
2584
|
-
if (currentScrollY >= 80) {
|
|
2585
|
-
if (currentScrollY > lastScrollY) {
|
|
2586
|
-
header.style.transform = "translateY(-100%)";
|
|
2587
|
-
header.setAttribute("data-header-scroll", true)
|
|
2588
|
-
} else {
|
|
2589
|
-
header.style.transform = "translateY(0px)";
|
|
2590
|
-
header.setAttribute("data-header-scroll", false)
|
|
2591
|
-
}
|
|
2592
|
-
} else {
|
|
2593
|
-
header.style.transform = "translateY(0)"; // Mostra sempre l'header se il scroll è inferiore a 80px
|
|
2594
|
-
header.setAttribute("data-header-scroll", false)
|
|
2595
|
-
}
|
|
2596
|
-
}
|
|
2597
|
-
lastScrollY = currentScrollY;
|
|
2598
|
-
|
|
2599
|
-
});
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
3135
|
/***/ }
|
|
2608
3136
|
|
|
2609
3137
|
/******/ });
|
|
@@ -2709,22 +3237,24 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2709
3237
|
/* harmony import */ var _pgs_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_pgs.js */ "./assets/javascript/_pgs.js");
|
|
2710
3238
|
/* harmony import */ var _base_darkmode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./base/_darkmode.js */ "./assets/javascript/base/_darkmode.js");
|
|
2711
3239
|
/* harmony import */ var _base_darkmode_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_base_darkmode_js__WEBPACK_IMPORTED_MODULE_1__);
|
|
2712
|
-
/* harmony import */ var
|
|
2713
|
-
/* harmony import */ var
|
|
2714
|
-
/* harmony import */ var
|
|
2715
|
-
/* harmony import */ var
|
|
2716
|
-
/* harmony import */ var
|
|
2717
|
-
/* harmony import */ var
|
|
2718
|
-
/* harmony import */ var
|
|
2719
|
-
/* harmony import */ var
|
|
2720
|
-
/* harmony import */ var
|
|
2721
|
-
/* harmony import */ var
|
|
2722
|
-
/* harmony import */ var
|
|
2723
|
-
/* harmony import */ var
|
|
2724
|
-
/* harmony import */ var
|
|
2725
|
-
/* harmony import */ var
|
|
2726
|
-
/* harmony import */ var
|
|
2727
|
-
/* harmony import */ var
|
|
3240
|
+
/* harmony import */ var _base_svg_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./base/_svg.js */ "./assets/javascript/base/_svg.js");
|
|
3241
|
+
/* harmony import */ var _base_object_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./base/_object.js */ "./assets/javascript/base/_object.js");
|
|
3242
|
+
/* harmony import */ var _base_object_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_base_object_js__WEBPACK_IMPORTED_MODULE_3__);
|
|
3243
|
+
/* harmony import */ var _components_accordion_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./components/_accordion.js */ "./assets/javascript/components/_accordion.js");
|
|
3244
|
+
/* harmony import */ var _components_dropdown_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./components/_dropdown.js */ "./assets/javascript/components/_dropdown.js");
|
|
3245
|
+
/* harmony import */ var _components_menu_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./components/_menu.js */ "./assets/javascript/components/_menu.js");
|
|
3246
|
+
/* harmony import */ var _components_modals_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./components/_modals.js */ "./assets/javascript/components/_modals.js");
|
|
3247
|
+
/* harmony import */ var _components_search_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./components/_search.js */ "./assets/javascript/components/_search.js");
|
|
3248
|
+
/* harmony import */ var _components_slides_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./components/_slides.js */ "./assets/javascript/components/_slides.js");
|
|
3249
|
+
/* harmony import */ var _components_steps_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./components/_steps.js */ "./assets/javascript/components/_steps.js");
|
|
3250
|
+
/* harmony import */ var _components_stepTabs_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./components/_stepTabs.js */ "./assets/javascript/components/_stepTabs.js");
|
|
3251
|
+
/* harmony import */ var _components_summary_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./components/_summary.js */ "./assets/javascript/components/_summary.js");
|
|
3252
|
+
/* harmony import */ var _components_notifications_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./components/_notifications.js */ "./assets/javascript/components/_notifications.js");
|
|
3253
|
+
/* harmony import */ var _imports_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./_imports.js */ "./assets/javascript/_imports.js");
|
|
3254
|
+
/* harmony import */ var _layout_header_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./layout/_header.js */ "./assets/javascript/layout/_header.js");
|
|
3255
|
+
/* harmony import */ var _layout_header_js__WEBPACK_IMPORTED_MODULE_15___default = /*#__PURE__*/__webpack_require__.n(_layout_header_js__WEBPACK_IMPORTED_MODULE_15__);
|
|
3256
|
+
/* harmony import */ var _patterns_cookieConsent_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./patterns/_cookieConsent.js */ "./assets/javascript/patterns/_cookieConsent.js");
|
|
3257
|
+
/* harmony import */ var _patterns_cookieConsent_js__WEBPACK_IMPORTED_MODULE_16___default = /*#__PURE__*/__webpack_require__.n(_patterns_cookieConsent_js__WEBPACK_IMPORTED_MODULE_16__);
|
|
2728
3258
|
//= PGS
|
|
2729
3259
|
|
|
2730
3260
|
|
|
@@ -2733,6 +3263,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2733
3263
|
|
|
2734
3264
|
|
|
2735
3265
|
|
|
3266
|
+
|
|
2736
3267
|
//= CN
|
|
2737
3268
|
|
|
2738
3269
|
|
|
@@ -2744,11 +3275,14 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2744
3275
|
|
|
2745
3276
|
|
|
2746
3277
|
|
|
3278
|
+
|
|
2747
3279
|
//= IMPORT REGISTRY
|
|
2748
3280
|
|
|
2749
3281
|
|
|
2750
|
-
//=
|
|
3282
|
+
//= LAYOUT
|
|
3283
|
+
|
|
2751
3284
|
|
|
3285
|
+
//= PATTERNS
|
|
2752
3286
|
|
|
2753
3287
|
|
|
2754
3288
|
})();
|