mypgs 1.1.5 → 1.3.2

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.
@@ -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,15 @@ 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
+ PGS_name: "PGS_slides",
192
+ init: PGS_slides_init,
193
+ api: PGS_slides_api
194
+ };
@@ -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,35 @@ 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
+ PGS_name: "PGS_stepTabs",
144
+ init: PGS_stepTabs_init,
145
+ api: PGS_stepTabs_api
146
+ };
147
+
135
148
  /*
136
149
  / EXAMPLE
137
150
  // 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,37 @@ 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
+ PGS_name: "PGS_steps",
52
+ init: PGS_steps_init,
53
+ api: PGS_steps_api
54
+ };
@@ -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";
@@ -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;
@@ -44,6 +44,8 @@ declare global {
44
44
  (root: Document): PgsDocumentApi;
45
45
  (root: Element): PgsElementApi;
46
46
  (root: Document | Element): PgsApi;
47
+ registerImport(...modules: unknown[]): PgsFunction;
48
+ import(...names: string[]): Record<string, any>;
47
49
  }
48
50
 
49
51
  interface PgsBag extends PgsElementApi {}
@@ -51,4 +53,6 @@ declare global {
51
53
  var pgs: PgsFunction;
52
54
  }
53
55
 
54
- export {};
56
+ export function pgs(root: Document): PgsDocumentApi;
57
+ export function pgs(root: Element): PgsElementApi;
58
+ export function pgs(root: Document | Element): PgsApi;
@@ -6,7 +6,7 @@
6
6
  --logo-finter: invert(1) hue-rotate(180deg) brightness(1.5);
7
7
 
8
8
  //== DARKMODE
9
- @at-root [data-darkmode=true] #{&}[pgs~="logo-darkmode"] [pgs~="logo-image"] {
9
+ @at-root [data-darkmode=true] [pgs~="logo-darkmode"] [pgs~="logo-image"] {
10
10
  filter: var(--logo-finter);
11
11
  }
12
12
 
@@ -1,5 +1,4 @@
1
1
  //# pageShell
2
-
3
2
  [pgs~="pageShell"] {
4
3
  --pageShell-aside-left-width: 400px;
5
4
  --pageShell-aside-right-width: 400px;
@@ -11,12 +10,7 @@
11
10
  --pageShell-aside-sticky-bottom: var(--pageShell-gap);
12
11
  --pageShell-aside-count: 0;
13
12
  --pageShell-gap-count: 0;
14
- --pageShell-max-width: calc(
15
- var(--pageShell-content-max-width) +
16
- var(--pageShell-aside-width-total) +
17
- (var(--pageShell-gap) * var(--pageShell-gap-count))
18
- );
19
-
13
+ --pageShell-max-width: calc(var(--pageShell-content-max-width) + var(--pageShell-aside-width-total) + (var(--pageShell-gap) * var(--pageShell-gap-count)));
20
14
  display: grid;
21
15
  grid-template-columns: minmax(0, var(--pageShell-content-max-width));
22
16
  grid-template-areas: "content";
@@ -33,8 +27,7 @@
33
27
  --pageShell-aside-count: 1;
34
28
  --pageShell-gap-count: 1;
35
29
  grid-template-columns:
36
- var(--pageShell-aside-left-width)
37
- minmax(var(--pageShell-content-min-width), var(--pageShell-content-max-width));
30
+ var(--pageShell-aside-left-width) minmax(var(--pageShell-content-min-width), var(--pageShell-content-max-width));
38
31
  grid-template-areas: "aside-left content";
39
32
  }
40
33
 
@@ -43,8 +36,7 @@
43
36
  --pageShell-aside-count: 1;
44
37
  --pageShell-gap-count: 1;
45
38
  grid-template-columns:
46
- minmax(var(--pageShell-content-min-width), var(--pageShell-content-max-width))
47
- var(--pageShell-aside-right-width);
39
+ minmax(var(--pageShell-content-min-width), var(--pageShell-content-max-width)) var(--pageShell-aside-right-width);
48
40
  grid-template-areas: "content aside-right";
49
41
  }
50
42
 
@@ -53,16 +45,15 @@
53
45
  --pageShell-aside-count: 2;
54
46
  --pageShell-gap-count: 2;
55
47
  grid-template-columns:
56
- var(--pageShell-aside-left-width)
57
- minmax(var(--pageShell-content-min-width), var(--pageShell-content-max-width))
58
- var(--pageShell-aside-right-width);
48
+ var(--pageShell-aside-left-width) minmax(var(--pageShell-content-min-width), var(--pageShell-content-max-width)) var(--pageShell-aside-right-width);
59
49
  grid-template-areas: "aside-left content aside-right";
60
50
  }
61
-
51
+
62
52
  [pgs~="pageShell-content"] {
63
53
  grid-area: content;
64
54
  width: 100%;
65
55
  min-width: 0;
56
+ padding-block: var(--page-top);
66
57
  }
67
58
 
68
59
  [pgs~="pageShell-asideLeft"],
@@ -71,13 +62,16 @@
71
62
  align-items: flex-start;
72
63
  isolation: isolate;
73
64
  position: sticky;
74
- top: var(--pageShell-aside-sticky-top);
65
+ // top: var(--pageShell-aside-sticky-top);
66
+ top: 0;
75
67
  width: 100%;
76
- max-height: calc(100svh - var(--pageShell-aside-sticky-top) - var(--pageShell-aside-sticky-bottom));
68
+ max-height: 100svh;
77
69
  overflow-y: auto;
78
70
  overscroll-behavior: contain;
79
71
  scrollbar-gutter: stable;
80
72
  scrollbar-width: none;
73
+ padding-block: var(--page-top);
74
+ padding-bottom: var(--padding-2);
81
75
 
82
76
  &::-webkit-scrollbar {
83
77
  display: none;
@@ -88,7 +82,6 @@
88
82
  }
89
83
  }
90
84
 
91
-
92
85
  [pgs~="pageShell-asideLeft"] {
93
86
  grid-area: aside-left;
94
87
  max-width: var(--pageShell-aside-left-width);
@@ -119,7 +112,7 @@
119
112
  }
120
113
 
121
114
  //- laptop
122
- @media (max-width: $laptop){
115
+ @media (max-width: $laptop) {
123
116
  &:has(> [pgs~="pageShell-asideLeft"]):has(> [pgs~="pageShell-asideRight"]) {
124
117
  grid-template-columns: minmax(0, var(--pageShell-content-max-width));
125
118
  grid-template-areas:
@@ -153,11 +146,13 @@
153
146
  }
154
147
 
155
148
  @media (max-width: $tablet) {
149
+
156
150
  [pgs~="pageShell-asideLeft"],
157
151
  [pgs~="pageShell-asideRight"],
158
152
  [pgs~="pageShell-content"] {
159
153
  width: 100%;
160
154
  max-width: none;
155
+ padding-block: unset;
161
156
  }
162
157
 
163
158
  [pgs~="pageShell-asideLeft"],
@@ -168,4 +163,4 @@
168
163
  overflow: visible;
169
164
  }
170
165
  }
171
- }
166
+ }
@@ -2299,11 +2299,7 @@ body [pgs~=bodyImg] img, [pgs~=bodyImg] object, [pgs~=bodyImg] lottie-player {
2299
2299
  --pageShell-aside-sticky-bottom: var(--pageShell-gap);
2300
2300
  --pageShell-aside-count: 0;
2301
2301
  --pageShell-gap-count: 0;
2302
- --pageShell-max-width: calc(
2303
- var(--pageShell-content-max-width) +
2304
- var(--pageShell-aside-width-total) +
2305
- (var(--pageShell-gap) * var(--pageShell-gap-count))
2306
- );
2302
+ --pageShell-max-width: calc(var(--pageShell-content-max-width) + var(--pageShell-aside-width-total) + (var(--pageShell-gap) * var(--pageShell-gap-count)));
2307
2303
  display: grid;
2308
2304
  grid-template-columns: minmax(0, var(--pageShell-content-max-width));
2309
2305
  grid-template-areas: "content";
@@ -2340,6 +2336,7 @@ body [pgs~=bodyImg] img, [pgs~=bodyImg] object, [pgs~=bodyImg] lottie-player {
2340
2336
  grid-area: content;
2341
2337
  width: 100%;
2342
2338
  min-width: 0;
2339
+ padding-block: var(--page-top);
2343
2340
  }
2344
2341
  [pgs~=initP] [pgs~=pageShell] [pgs~=pageShell-asideLeft],
2345
2342
  [pgs~=initP] [pgs~=pageShell] [pgs~=pageShell-asideRight] {
@@ -2349,13 +2346,15 @@ body [pgs~=bodyImg] img, [pgs~=bodyImg] object, [pgs~=bodyImg] lottie-player {
2349
2346
  align-items: flex-start;
2350
2347
  isolation: isolate;
2351
2348
  position: sticky;
2352
- top: var(--pageShell-aside-sticky-top);
2349
+ top: 0;
2353
2350
  width: 100%;
2354
- max-height: calc(100svh - var(--pageShell-aside-sticky-top) - var(--pageShell-aside-sticky-bottom));
2351
+ max-height: 100svh;
2355
2352
  overflow-y: auto;
2356
2353
  overscroll-behavior: contain;
2357
2354
  scrollbar-gutter: stable;
2358
2355
  scrollbar-width: none;
2356
+ padding-block: var(--page-top);
2357
+ padding-bottom: var(--padding-2);
2359
2358
  }
2360
2359
  [pgs~=initP] [pgs~=pageShell] [pgs~=pageShell-asideLeft]::-webkit-scrollbar,
2361
2360
  [pgs~=initP] [pgs~=pageShell] [pgs~=pageShell-asideRight]::-webkit-scrollbar {
@@ -2415,6 +2414,7 @@ body [pgs~=bodyImg] img, [pgs~=bodyImg] object, [pgs~=bodyImg] lottie-player {
2415
2414
  [pgs~=initP] [pgs~=pageShell] [pgs~=pageShell-content] {
2416
2415
  width: 100%;
2417
2416
  max-width: none;
2417
+ padding-block: unset;
2418
2418
  }
2419
2419
  [pgs~=initP] [pgs~=pageShell] [pgs~=pageShell-asideLeft],
2420
2420
  [pgs~=initP] [pgs~=pageShell] [pgs~=pageShell-asideRight] {
@@ -7053,7 +7053,7 @@ dialog [pgs~=initP] [pgs~=searchbar] input {
7053
7053
  --logo-height: var(--header-size, 6.0rem);
7054
7054
  --logo-finter: invert(1) hue-rotate(180deg) brightness(1.5);
7055
7055
  }
7056
- [data-darkmode=true] [pgs~=initP] [pgs~=logo][pgs~=logo-darkmode] [pgs~=logo-image] {
7056
+ [data-darkmode=true] [pgs~=logo-darkmode] [pgs~=logo-image] {
7057
7057
  filter: var(--logo-finter);
7058
7058
  }
7059
7059