mypgs 1.1.5 → 1.3.3

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.
Files changed (80) hide show
  1. package/AI_GUIDELINES.md +353 -0
  2. package/README.md +483 -53
  3. package/assets/javascript/_imports.js +26 -0
  4. package/assets/javascript/_pgs.js +53 -2
  5. package/assets/javascript/components/_accordion.js +114 -66
  6. package/assets/javascript/components/_dropdown.js +199 -98
  7. package/assets/javascript/components/_menu.js +33 -69
  8. package/assets/javascript/components/_modals.js +44 -3
  9. package/assets/javascript/components/_notifications.js +162 -0
  10. package/assets/javascript/components/_slides.js +11 -1
  11. package/assets/javascript/components/_stepTabs.js +16 -4
  12. package/assets/javascript/components/_steps.js +32 -6
  13. package/assets/javascript/functions/_formValidate.js +4 -5
  14. package/assets/javascript/index.js +8 -4
  15. package/assets/javascript/patterns/_cookieConsent.js +8 -2
  16. package/assets/javascript/patterns/_header.js +1 -1
  17. package/assets/javascript/pgs.d.ts +17 -2
  18. package/assets/scss/base/_html.scss +23 -1
  19. package/assets/scss/components/_dropdown.scss +24 -88
  20. package/assets/scss/components/_logo.scss +1 -1
  21. package/assets/scss/components/_menu.scss +129 -15
  22. package/assets/scss/components/_modals.scss +15 -3
  23. package/assets/scss/components/_notification.scss +11 -14
  24. package/assets/scss/components/_tooltip.scss +2 -9
  25. package/assets/scss/index.scss +0 -1
  26. package/assets/scss/layout/_gap.scss +7 -1
  27. package/assets/scss/layout/_layout.scss +0 -12
  28. package/assets/scss/layout/_pageShell.scss +102 -108
  29. package/assets/scss/mixin/_mx-form.scss +1 -3
  30. package/assets/scss/mixin/_mx-responsive.scss +2 -2
  31. package/assets/scss/mixin/_mx-semantic.scss +0 -60
  32. package/assets/scss/mixin/mixin.scss +0 -1
  33. package/assets/scss/patterns/_footer.scss +1 -0
  34. package/assets/scss/patterns/_header.scss +20 -18
  35. package/dist/css/index.css +325 -1161
  36. package/dist/css/index.css.map +1 -1
  37. package/dist/css/index.min.css +1 -1
  38. package/dist/index.d.ts +17 -2
  39. package/dist/javascript/index.js +985 -412
  40. package/dist/javascript/index.js.map +1 -1
  41. package/dist/javascript/index.min.js +1 -1
  42. package/package.json +7 -2
  43. package/templates/components/{md-accordion.html → accordion.html} +2 -2
  44. package/templates/components/dropdown.html +91 -0
  45. package/templates/components/menu.html +41 -0
  46. package/templates/components/modal.html +78 -0
  47. package/templates/components/notification.html +35 -0
  48. package/templates/components/{md-slides.html → slides.html} +5 -5
  49. package/templates/components/{md-steps.html → steps.html} +7 -7
  50. package/templates/components/{md-tooltip.html → tooltip.html} +4 -2
  51. package/templates/demo.css +18 -0
  52. package/templates/demo.html +4 -5
  53. package/templates/demo.js +53 -52
  54. package/templates/layout/flex.html +89 -0
  55. package/templates/layout/grid.html +89 -0
  56. package/templates/layout/pageShell.html +59 -0
  57. package/templates/layout/section.html +40 -0
  58. package/templates/{layout/md-footer.html → patterns/footer.html} +1 -0
  59. package/templates/{layout/md-header.html → patterns/header.html} +6 -9
  60. package/assets/javascript/components/_exeNotifications.js +0 -85
  61. package/assets/javascript/functions/_notifications.js +0 -74
  62. package/assets/javascript/functions/_sendForm.js +0 -100
  63. package/assets/scss/base/_reset.scss +0 -15
  64. package/assets/scss/mixin/_mx-menu.scss +0 -154
  65. package/templates/components/md-dropdown.html +0 -16
  66. package/templates/components/md-menu.html +0 -40
  67. package/templates/components/md-modal.html +0 -19
  68. package/templates/components/md-notification.html +0 -13
  69. package/templates/layout/md-pageShell.html +0 -22
  70. package/templates/layout/md-section.html +0 -25
  71. /package/templates/components/{md-breadcumbs.html → breadcumbs.html} +0 -0
  72. /package/templates/components/{md-button.html → button.html} +0 -0
  73. /package/templates/components/{md-card.html → card.html} +0 -0
  74. /package/templates/components/{md-form.html → form.html} +0 -0
  75. /package/templates/components/{md-logo.html → logo.html} +0 -0
  76. /package/templates/components/{md-searchbar.html → searchbar.html} +0 -0
  77. /package/templates/components/{md-stepTabs.html → stepTabs.html} +0 -0
  78. /package/templates/components/{md-table.html → table.html} +0 -0
  79. /package/templates/layout/{md-body.html → body.html} +0 -0
  80. /package/templates/{layout/md-cookieConsent.html → patterns/cookieConsent.html} +0 -0
@@ -1,92 +1,56 @@
1
- import { pgs_dropdown } from "./_dropdown";
1
+ import { PGS_dropdown } from "./_dropdown";
2
+
3
+ const API = new WeakMap();
2
4
 
3
5
  //= DROP DOWN MENU
4
- export function PGS_menu() {
6
+ function PGS_menu_init(root = document) {
7
+
8
+ pgs(root).querySelectorAll('menu').forEach(MENU => {
9
+ if (API.has(MENU)) return;
5
10
 
6
- pgs(document).querySelectorAll('menu-horizontal').forEach(MENU => {
11
+ MENU.querySelectorAll('li').forEach(li => {
12
+ const ul = li.querySelector("ul");
7
13
 
8
- MENU.querySelectorAll('nav > ul > li.menu-item-has-children').forEach(li => {
9
- if (li.querySelector("ul")) {
10
- const ul = li.querySelector("ul");
14
+ if (ul) {
11
15
 
12
16
  const button = document.createElement("button");
13
- button.className = "icon-down";
14
17
  button.type = "button";
15
18
  button.innerHTML = "<span>&#9207;</span>";
19
+ pgs(button).add("menu-buttonIcon");
16
20
  li.querySelector("a").insertAdjacentElement("afterend", button);
17
21
 
18
22
  pgs(li).add("dropdown")
19
23
  pgs(button).add("dropdown-button")
20
24
  pgs(button).add("buttonNohover")
21
25
  pgs(ul).add("dropdown-content")
22
- pgs(ul).add("menu-vertical")
26
+
23
27
  }
24
28
  });
25
- });
26
-
27
- pgs(document).querySelectorAll('menu-vertical').forEach(MENU => {
28
-
29
- MENU.querySelectorAll('.menu-item-has-children').forEach((li, index) => {
30
- const ul = li.querySelector("ul");
31
-
32
- if (!ul) return
33
29
 
34
- const button = document.createElement("button");
35
- button.className = "icon-down buttonIcon";
36
- button.type = "button";
37
-
38
- // ID unico per aria-controls
39
- const submenuId = `vertical-submenu-${index}`;
40
- ul.id = submenuId;
41
-
42
- // Stato iniziale
43
- pgs(button).add("buttonIcon")
44
- button.setAttribute("aria-expanded", "false");
45
- button.setAttribute("aria-controls", submenuId);
46
- button.setAttribute("aria-label", "Apri sottomenu");
47
- button.innerHTML = "<span aria-hidden='true'>&#9207;</span>";
48
- li.querySelector("a").insertAdjacentElement("afterend", button);
49
-
50
- function toggleMenu() {
51
- // const isOpena = ul.classList.toggle("open");
52
- const isOpen = pgs(ul).state.toggle("open");
53
- button.setAttribute("aria-expanded", isOpen);
54
- button.setAttribute("aria-label", isOpen ? "Chiudi sottomenu" : "Apri sottomenu");
55
- };
56
-
57
- // Click
58
- button.addEventListener("click", toggleMenu);
59
- button.addEventListener("keydown", (e) => {
60
- if (e.key === "Enter" || e.key === " ") {
61
- e.preventDefault();
62
- toggleMenu();
63
- }
64
- });
30
+ API.set(MENU, {
31
+ element: MENU,
32
+ type: "horizontal",
33
+ // items: () => Array.from(MENU.querySelectorAll('nav > ul > li')),
34
+ // submenus: () => Array.from(MENU.querySelectorAll('.menu-item-has-children > ul')),
35
+ // dropdowns: () => Array.from(MENU.querySelectorAll('.menu-item-has-children')).map(PGS_dropdown_api).filter(Boolean),
36
+ refresh: () => {
37
+ PGS_menu_init(MENU.parentNode || document);
38
+ return API.get(MENU);
39
+ },
65
40
  });
41
+ PGS_dropdown.init(MENU);
42
+ });
66
43
 
67
- // pgs(document).querySelectorAll('menu-vertical').forEach(MENU => {
68
-
69
- // MENU.querySelectorAll('.menu-item-has-children').forEach(li => {
70
- // if (li.querySelector("ul")) {
71
- // const ul = li.querySelector("ul");
72
-
73
- // const button = document.createElement("button");
74
- // button.className = "icon-down";
75
- // button.type = "button";
76
- // button.innerHTML = "<span>&#9207;</span>";
77
- // li.querySelector("a").insertAdjacentElement("afterend", button);
44
+ }
78
45
 
46
+ PGS_menu_init()
79
47
 
80
- // pgs(button).add("buttonIcon")
81
- // button.addEventListener("click", () => {
82
- // ul.classList.toggle("open")
83
- // })
84
- // }
85
- // });
86
- // });
87
- });
88
- pgs_dropdown()
48
+ function PGS_menu_api(selector) {
49
+ return API.get(selector);
89
50
  }
90
51
 
91
- //# INIT PGS_menu
92
- PGS_menu()
52
+ //# EXPORT
53
+ export const PGS_menu = {
54
+ init: PGS_menu_init,
55
+ api: PGS_menu_api
56
+ };
@@ -1,7 +1,9 @@
1
1
  //# MODAL
2
- PGS_modal()
3
- export function PGS_modal(selector = "modal") {
2
+ const API = new WeakMap();
3
+
4
+ export function PGS_modal_init(selector = "modal") {
4
5
  pgs(document).querySelectorAll(selector).forEach(MODAL => {
6
+ if (API.has(MODAL)) return;
5
7
 
6
8
  const BUTTON_OPEN = pgs(MODAL).querySelector("modal-button");
7
9
  const DIALOG = MODAL.querySelector("dialog");
@@ -54,9 +56,14 @@ export function PGS_modal(selector = "modal") {
54
56
  //+ FN OPEN
55
57
  function openModal(e) {
56
58
  e?.stopImmediatePropagation();
59
+ if (DIALOG.open) {
60
+ closeModal(e);
61
+ return;
62
+ }
63
+
57
64
  if (!DIALOG.open) document.querySelectorAll("dialog[open]").forEach((dlg) => dlg.close());
58
65
  statusModal(true);
59
- DIALOG.open ? closeModal(e) : topLevel ? DIALOG.showModal() : DIALOG.show();
66
+ topLevel ? DIALOG.showModal() : DIALOG.show();
60
67
  // modalCustomEvents('modal:open', { event: e });
61
68
  MODAL.dispatchEvent(new CustomEvent('modal:open'));
62
69
  DIALOG.dispatchEvent(new CustomEvent('modal:open'));
@@ -72,6 +79,14 @@ export function PGS_modal(selector = "modal") {
72
79
  DIALOG.dispatchEvent(new CustomEvent('modal:close'));
73
80
  }
74
81
 
82
+ function forceOpen(e) {
83
+ if (!DIALOG.open) openModal(e);
84
+ }
85
+
86
+ function forceClose(e) {
87
+ if (DIALOG.open) closeModal(e);
88
+ }
89
+
75
90
  //+ fn OPEN ON HISTORY
76
91
  function openModalOnHistory() {
77
92
  const params = new URLSearchParams(window.location.search);
@@ -117,7 +132,33 @@ export function PGS_modal(selector = "modal") {
117
132
  } catch (_) { }
118
133
  });
119
134
  }
135
+
136
+ API.set(MODAL, {
137
+ element: MODAL,
138
+ button: BUTTON_OPEN,
139
+ dialog: DIALOG,
140
+ closeButton: BUTTON_CLOSE,
141
+ open: forceOpen,
142
+ close: forceClose,
143
+ toggle: openModal,
144
+ refresh: () => {
145
+ PGS_modal_init(selector);
146
+ return API.get(MODAL);
147
+ },
148
+ isOpen: () => DIALOG.open,
149
+ });
120
150
  });
121
151
  }
122
152
 
123
153
  //# INIT PGS_modal
154
+ PGS_modal_init()
155
+
156
+ //# API
157
+ export function PGS_modal_api(selector) {
158
+ return API.get(selector);
159
+ }
160
+
161
+ export const PGS_modal = {
162
+ init: PGS_modal_init,
163
+ api: PGS_modal_api
164
+ };
@@ -0,0 +1,162 @@
1
+ //= PGS_notification
2
+ const fn_notification = {
3
+ _escapeHtml(value) {
4
+ return String(value ?? "");
5
+ },
6
+
7
+ _getDuration(notification) {
8
+ const rawDuration = notification.duration;
9
+ const duration = Number.parseInt(rawDuration, 10);
10
+
11
+ return Number.isNaN(duration) ? 5000 : duration;
12
+ },
13
+
14
+ _getApi(notification) {
15
+ const element = String(notification.element || "notification").trim();
16
+
17
+ return element === "toast" ? PGS_notification.toast : PGS_notification.alert;
18
+ },
19
+
20
+ _getType(notification, api) {
21
+ const type = String(notification.type || "info").trim();
22
+
23
+ return typeof api[type] === "function" ? type : "info";
24
+ },
25
+
26
+ _getData(root) {
27
+ try {
28
+ return JSON.parse(root.dataset.notification || "{}");
29
+ } catch (error) {
30
+ console.warn("PGS notification: dati non validi", error);
31
+ return {};
32
+ }
33
+ },
34
+
35
+ _getContent(title, content) {
36
+ const safeContent = this._escapeHtml(content);
37
+ const safeTitle = this._escapeHtml(title);
38
+
39
+ if (!safeTitle) return safeContent;
40
+ if (!safeContent) return `<span pgs="notification-element-title">${safeTitle}</span>`;
41
+
42
+ return `
43
+ <span pgs="notification-element-title">${safeTitle}</span>
44
+ <br>
45
+ <span pgs="notification-element-content">${safeContent}</span>
46
+ `;
47
+ },
48
+
49
+ initNotification(type, containerToken, icon, text, timeout, methodDelete = "replace", link = null) {
50
+ let containerNotification = pgs(document).querySelector(containerToken);
51
+
52
+ //== Create Container
53
+ if (!containerNotification) {
54
+ const newContainer = document.createElement("div");
55
+ pgs(newContainer).add(containerToken);
56
+ newContainer.setAttribute("aria-live", "polite");
57
+ newContainer.setAttribute("aria-relevant", "additions");
58
+ document.body.appendChild(newContainer);
59
+ containerNotification = newContainer;
60
+ }
61
+
62
+ //== Create Notification
63
+ const notification = document.createElement(link ? "a" : "div");
64
+ if (methodDelete == "replace") containerNotification.innerHTML = "";
65
+ if (link) notification.href = link;
66
+ if (timeout > 0) notification.style.setProperty("--notification-timeout", timeout + "ms");
67
+ pgs(notification).state.add(type);
68
+ pgs(notification).add("notification-element");
69
+ notification.setAttribute("role", type == "error" ? "alert" : "status")
70
+ notification.innerHTML = `${icon} <p>${text}</p>`;
71
+ containerNotification.appendChild(notification);
72
+
73
+
74
+ //+ Animation delete
75
+ function deleteNotification() {
76
+ methodDelete == "stack" ? notification.style.translate = "120%" : notification.style.opacity = "0";
77
+ setTimeout(() => notification.remove(), 300);
78
+ }
79
+
80
+ //== Timeout delete
81
+ if (timeout > 0) setTimeout(() => { deleteNotification() }, timeout);
82
+
83
+ //== button delete
84
+ const btnDelete = document.createElement("button");
85
+ btnDelete.type = "button";
86
+ btnDelete.ariaLabel = "Rimuovi notifica";
87
+ btnDelete.innerHTML = '<i class="fa-solid fa-xmark"></i>';
88
+ btnDelete.setAttribute("pgs", "buttonClose");
89
+ notification.insertAdjacentElement("afterbegin", btnDelete);
90
+
91
+ //== event
92
+
93
+ btnDelete.addEventListener("click", function (e) {
94
+ e.preventDefault();
95
+ e.stopPropagation();
96
+ e.stopImmediatePropagation()
97
+ deleteNotification(e); // Esegue la tua funzione
98
+ });
99
+ },
100
+
101
+ deleteAll(containerToken) {
102
+ let containerNotification = pgs(document).querySelector(containerToken);
103
+ if (containerNotification) containerNotification.innerHTML = "";
104
+ },
105
+
106
+ trigger(root = document) {
107
+ pgs(root).querySelectorAll("notificationTrigger").forEach(element => {
108
+ if (!element || element.dataset.initialize === "true") return;
109
+
110
+ element.dataset.initialize = "true";
111
+
112
+ const notification = this._getData(element);
113
+ const title = String(notification.title || "").trim();
114
+ const content = String(notification.message || "").trim();
115
+
116
+ if (!title && !content) {
117
+ element.remove();
118
+ return;
119
+ }
120
+
121
+ const link = notification.link || null;
122
+ const icon = notification.icon || undefined;
123
+ const duration = this._getDuration(notification);
124
+ const api = this._getApi(notification);
125
+ const type = this._getType(notification, api);
126
+ const formattedContent = this._getContent(title, content);
127
+
128
+ if (api === PGS_notification.toast) api[type](formattedContent, duration, icon);
129
+ else api[type](formattedContent, link, duration, icon);
130
+
131
+ element.remove();
132
+ });
133
+ }
134
+ };
135
+
136
+ //# EXPORT
137
+ export function PGS_notificationTrigger_init(root = document) {
138
+ return fn_notification.trigger(root);
139
+ }
140
+
141
+ export const PGS_notification = {
142
+ trigger: PGS_notificationTrigger_init,
143
+ alert: {
144
+ error: (text = "Errore", link = null, timeout = 0, icon = '<i class="fa-solid fa-circle-xmark"></i>') => fn_notification.initNotification("error", "notification", icon, text, timeout, "stack", link),
145
+ success: (text = "Aggiornato", link = null, timeout = 0, icon = '<i class="fa-solid fa-check"></i>') => fn_notification.initNotification("success", "notification", icon, text, timeout, "stack", link),
146
+ info: (text = "Aggiornamento", link = null, timeout = 0, icon = '<i class="fa-solid fa-circle-info"></i>',) => fn_notification.initNotification("info", "notification", icon, text, timeout, "stack", link),
147
+ warning: (text = "Attenzione", link = null, timeout = 0, icon = '<i class="fa-solid fa-triangle-exclamation"></i>') => fn_notification.initNotification("warning", "notification", icon, text, timeout, "stack", link),
148
+ deleteAll: () => fn_notification.deleteAll("notification")
149
+ },
150
+ toast: {
151
+ error: (text = "Errore", timeout = 4000, icon = '<i class="fa-solid fa-circle-xmark"></i>',) => fn_notification.initNotification("error", "toast", icon, text, timeout),
152
+ success: (text = "Aggiornato", timeout = 4000, icon = '<i class="fa-solid fa-check"></i>',) => fn_notification.initNotification("success", "toast", icon, text, timeout),
153
+ info: (text = "Aggiornamento", timeout = 0, icon = '<i class="fa-solid fa-circle-info"></i>',) => fn_notification.initNotification("info", "toast", icon, text, timeout),
154
+ warning: (text = "Attenzione", timeout = 4000, icon = '<i class="fa-solid fa-triangle-exclamation"></i>',) => fn_notification.initNotification("warning", "toast", icon, text, timeout),
155
+ deleteAll: () => fn_notification.deleteAll("toast")
156
+ }
157
+ };
158
+
159
+
160
+ //= EXECUTE
161
+ if (document.readyState === "loading") document.addEventListener("DOMContentLoaded", () => PGS_notificationTrigger_init());
162
+ else PGS_notificationTrigger_init();
@@ -162,10 +162,13 @@ class PGS_Slides {
162
162
  const last = children[children.length - 1];
163
163
  return last?.classList.contains("view") || false;
164
164
  },
165
+ refresh: () => {
166
+ PGS_slides_init(this.selector.parentNode || document);
167
+ return API.get(this.selector);
168
+ },
165
169
  });
166
170
  }
167
171
  }
168
- PGS_slides_init();
169
172
 
170
173
  //# INIT
171
174
  export function PGS_slides_init(root = document) {
@@ -177,7 +180,14 @@ export function PGS_slides_init(root = document) {
177
180
  });
178
181
  }
179
182
 
183
+ PGS_slides_init();
184
+
180
185
  //# API
181
186
  export function PGS_slides_api(selector) {
182
187
  return API.get(selector);
183
188
  }
189
+
190
+ export const PGS_slides = {
191
+ init: PGS_slides_init,
192
+ api: PGS_slides_api
193
+ };
@@ -1,8 +1,7 @@
1
1
  const API = new WeakMap();
2
- PGS_stepTabs()
3
2
 
4
- export function PGS_stepTabs() {
5
- pgs(document).querySelectorAll("stepTabs").forEach(tabsWizard => {
3
+ export function PGS_stepTabs_init(root = document) {
4
+ pgs(root).querySelectorAll("stepTabs").forEach(tabsWizard => {
6
5
  if (tabsWizard.dataset.stepTabsInitialized === "true") return;
7
6
  tabsWizard.dataset.stepTabsInitialized = "true";
8
7
 
@@ -117,21 +116,34 @@ export function PGS_stepTabs() {
117
116
  //-(API)
118
117
  // tabsWizard.addEventListener("stepTabs:reset", () => restartTab());
119
118
  API.set(tabsWizard, {
119
+ element: tabsWizard,
120
+ container: tabsContainer,
120
121
  restart: restartTab,
121
122
  goTo,
122
123
  next: () => goTo(current + 1),
123
124
  prev: () => goTo(current - 1),
124
125
  toggleLock: (step, lock = true) => typeof step === "number" && allTab[step] && (pgs(allTab[step]).state.toggle("is-locked", lock), goTo(current)),
126
+ refresh: () => {
127
+ PGS_stepTabs_init(tabsWizard.parentNode || document);
128
+ return API.get(tabsWizard);
129
+ },
125
130
  getCurrent: () => current,
126
131
  getState: () => ({ current, total }),
127
132
  });
128
133
  });
129
134
  }
130
135
 
131
- export function PGS_tabs_api(selector) {
136
+ PGS_stepTabs_init()
137
+
138
+ export function PGS_stepTabs_api(selector) {
132
139
  return API.get(selector);
133
140
  }
134
141
 
142
+ export const PGS_stepTabs = {
143
+ init: PGS_stepTabs_init,
144
+ api: PGS_stepTabs_api
145
+ };
146
+
135
147
  /*
136
148
  / EXAMPLE
137
149
  // vai allo step 2
@@ -1,6 +1,8 @@
1
+ const API = new WeakMap();
1
2
 
2
- export function PGS_ol() {
3
- pgs(document).querySelectorAll("steps").forEach(steps => {
3
+ export function PGS_steps_init(root = document) {
4
+ pgs(root).querySelectorAll("steps").forEach(steps => {
5
+ if (API.has(steps)) return;
4
6
 
5
7
  pgs(steps).querySelectorAll("steps-step").forEach((li, index) => {
6
8
 
@@ -16,12 +18,36 @@ export function PGS_ol() {
16
18
  }
17
19
 
18
20
  //= line
19
- const line = document.createElement("span");
20
- pgs(line).add("steps-step-line")
21
- li.insertAdjacentElement("afterbegin", line);
21
+ if (!pgs(li).querySelector("steps-step-line")) {
22
+ const line = document.createElement("span");
23
+ pgs(line).add("steps-step-line")
24
+ li.insertAdjacentElement("afterbegin", line);
25
+ }
26
+ });
27
+
28
+ API.set(steps, {
29
+ element: steps,
30
+ steps: () => Array.from(pgs(steps).querySelectorAll("steps-step")),
31
+ getStep: (index) => pgs(steps).querySelectorAll("steps-step")[index],
32
+ getTotal: () => pgs(steps).querySelectorAll("steps-step").length,
33
+ refresh: () => {
34
+ API.delete(steps);
35
+ PGS_steps_init(steps.parentNode || document);
36
+ return API.get(steps);
37
+ },
22
38
  });
23
39
  });
24
40
  }
25
41
 
26
42
  //# INIT PGS_ol
27
- PGS_ol()
43
+ PGS_steps_init()
44
+
45
+ //# API
46
+ export function PGS_steps_api(selector) {
47
+ return API.get(selector);
48
+ }
49
+
50
+ export const PGS_steps = {
51
+ init: PGS_steps_init,
52
+ api: PGS_steps_api
53
+ };
@@ -1,4 +1,4 @@
1
- import { PGS_toast } from "../functions/_notifications.js";
1
+ import { PGS_notification } from "../components/_notifications.js";
2
2
 
3
3
 
4
4
  export class PGS_formValidate {
@@ -15,8 +15,8 @@ export class PGS_formValidate {
15
15
 
16
16
  let message = field.getAttribute("data-form-field-message");
17
17
 
18
- if (i == 0 && message) PGS_toast.error(message);
19
- else if (i == 0) PGS_toast.error("Compila tutti i campi!");
18
+ if (i == 0 && message) PGS_notification.toast.error(message);
19
+ else if (i == 0) PGS_notification.toast.error("Compila tutti i campi!");
20
20
  }
21
21
 
22
22
  //+ REMOVE
@@ -202,7 +202,7 @@ export class PGS_formValidate {
202
202
  }
203
203
 
204
204
  ifSuccess(text = "Inviato con successo") {
205
- if (this.validate() == true) PGS_toast.success(text)
205
+ if (this.validate() == true) PGS_notification.toast.success(text)
206
206
  }
207
207
 
208
208
  // + -------------------------
@@ -214,4 +214,3 @@ export class PGS_formValidate {
214
214
  return this;
215
215
  }
216
216
  }
217
-
@@ -1,5 +1,6 @@
1
1
  //= PGS
2
- import "./_pgs.js";
2
+ import { pgs } from "./_pgs.js";
3
+ export { pgs } from "./_pgs.js";
3
4
 
4
5
  //= BASE
5
6
  import "./base/_darkmode.js";
@@ -8,13 +9,16 @@ import "./base/_object.js";
8
9
  //= CN
9
10
  import "./components/_accordion.js";
10
11
  import "./components/_dropdown.js";
11
- import "./components/_exeNotifications.js";
12
12
  import "./components/_menu.js"
13
13
  import "./components/_modals.js";
14
14
  import "./components/_slides.js"
15
15
  import "./components/_steps.js";
16
16
  import "./components/_stepTabs.js";
17
+ import "./components/_notifications.js";
17
18
 
18
- //= patterns
19
+ //= IMPORT REGISTRY
20
+ import "./_imports.js";
21
+
22
+ //= PATTERNS
19
23
  import "./patterns/_header.js";
20
- import "./patterns/_cookieConsent.js";
24
+ import "./patterns/_cookieConsent.js";
@@ -96,7 +96,7 @@ function assignCookieRuntimeAttributes({ root, analyticsToggle, acceptAllButton,
96
96
  }
97
97
 
98
98
  //= CookieConsent
99
- document.addEventListener('DOMContentLoaded', function () {
99
+ function initCookieConsent() {
100
100
  const root = pgs(document).querySelector('cookieConsent');
101
101
  if (!root) return;
102
102
 
@@ -206,4 +206,10 @@ document.addEventListener('DOMContentLoaded', function () {
206
206
  } else {
207
207
  setBannerVisibility(true);
208
208
  }
209
- });
209
+ }
210
+
211
+ if (document.readyState === 'loading') {
212
+ document.addEventListener('DOMContentLoaded', initCookieConsent);
213
+ } else {
214
+ initCookieConsent();
215
+ }
@@ -4,7 +4,7 @@ const headerElements = pgs(header).querySelectorAll("header-element");
4
4
  headerElements.forEach(element => PGS_header(element));
5
5
 
6
6
  //= HEADER
7
- export function PGS_header(selectHeader) {
7
+ function PGS_header(selectHeader) {
8
8
 
9
9
  //= INIT
10
10
  if (selectHeader.getAttribute("data-initialize") == "true") return;
@@ -31,7 +31,6 @@ declare global {
31
31
  value: string | null;
32
32
  state: PgsStateApi;
33
33
  option: PgsOptionApi;
34
- modules: PgsOptionApi;
35
34
  }
36
35
 
37
36
  interface PgsDocumentApi extends PgsQueryableApi {
@@ -44,6 +43,20 @@ declare global {
44
43
  (root: Document): PgsDocumentApi;
45
44
  (root: Element): PgsElementApi;
46
45
  (root: Document | Element): PgsApi;
46
+ registerImport(...modules: unknown[]): PgsFunction;
47
+ registerModules(modules: Record<string, any>): PgsFunction;
48
+ import(...names: string[]): Record<string, any>;
49
+ accordion?: any;
50
+ dropdown?: any;
51
+ menu?: any;
52
+ modal?: any;
53
+ notification?: any;
54
+ slides?: any;
55
+ stepTabs?: any;
56
+ steps?: any;
57
+ formValidate?: any;
58
+ scrollHorizontal?: any;
59
+ [moduleName: string]: any;
47
60
  }
48
61
 
49
62
  interface PgsBag extends PgsElementApi {}
@@ -51,4 +64,6 @@ declare global {
51
64
  var pgs: PgsFunction;
52
65
  }
53
66
 
54
- export {};
67
+ export function pgs(root: Document): PgsDocumentApi;
68
+ export function pgs(root: Element): PgsElementApi;
69
+ export function pgs(root: Document | Element): PgsApi;
@@ -1,4 +1,26 @@
1
1
  [pgs~="htmlBase"] {
2
2
  scroll-behavior: smooth;
3
3
  font-size: 62.5%;
4
- }
4
+
5
+ margin: 0;
6
+ padding: 0;
7
+ box-sizing: border-box;
8
+ scroll-margin-top: calc(var(--heightOfHeader) + 5vh);
9
+
10
+ // Reset properties
11
+ * {
12
+ margin: 0;
13
+ padding: 0;
14
+ box-sizing: border-box;
15
+ scroll-margin-top: calc(var(--heightOfHeader) + 5vh);
16
+ }
17
+
18
+ &:root,
19
+ :root {
20
+ interpolate-size: allow-keywords;
21
+ }
22
+
23
+ @view-transition {
24
+ navigation: auto;
25
+ }
26
+ }