mypgs 1.5.1 → 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 +1 -1
- 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 +5 -5
- package/assets/scss/base/_variables.scss +4 -2
- 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 +2 -2
- package/assets/scss/layout/_header.scss +1 -1
- package/assets/scss/layout/_pageShell.scss +1 -0
- package/dist/css/index.css +121 -52
- package/dist/css/index.css.map +1 -1
- package/dist/css/index.min.css +1 -1
- package/dist/index.d.ts +70 -0
- package/dist/javascript/index.js +685 -153
- package/dist/javascript/index.js.map +1 -1
- package/dist/javascript/index.min.js +1 -1
- package/docs/componenti-e-markup.md +37 -1
- package/docs/helper-javascript.md +3 -0
- package/package.json +1 -1
- 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
|
@@ -0,0 +1,391 @@
|
|
|
1
|
+
const API = new WeakMap();
|
|
2
|
+
const OPEN_SEARCHES = new Set();
|
|
3
|
+
let searchId = 0;
|
|
4
|
+
|
|
5
|
+
const DEFAULT_OPTIONS = {
|
|
6
|
+
minLength: 2,
|
|
7
|
+
debounce: 200,
|
|
8
|
+
limit: 8,
|
|
9
|
+
submitOnSelect: false,
|
|
10
|
+
searchOnFocus: true,
|
|
11
|
+
source: null,
|
|
12
|
+
onSelect: null,
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
function nextSearchId() {
|
|
16
|
+
searchId += 1;
|
|
17
|
+
return searchId;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function getSearches(root) {
|
|
21
|
+
const searches = root instanceof Element && pgs(root).contains("search") ? [root] : [];
|
|
22
|
+
searches.push(...pgs(root).querySelectorAll("search"));
|
|
23
|
+
return searches;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function directPgsChild(element, token) {
|
|
27
|
+
return Array.from(element.children).find(child => pgs(child).contains(token));
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function normalizeItem(item) {
|
|
31
|
+
if (typeof item === "string" || typeof item === "number") {
|
|
32
|
+
const value = String(item).trim();
|
|
33
|
+
return value ? { label: value, value, disabled: false, data: item } : null;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (!item || typeof item !== "object") return null;
|
|
37
|
+
|
|
38
|
+
const label = String(item.label ?? item.value ?? "").trim();
|
|
39
|
+
if (!label) return null;
|
|
40
|
+
|
|
41
|
+
return {
|
|
42
|
+
label,
|
|
43
|
+
value: String(item.value ?? label),
|
|
44
|
+
disabled: Boolean(item.disabled),
|
|
45
|
+
data: Object.prototype.hasOwnProperty.call(item, "data") ? item.data : item,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function normalizeOptions(current, options = {}) {
|
|
50
|
+
const next = { ...current, ...options };
|
|
51
|
+
next.minLength = Math.max(0, Number.parseInt(next.minLength, 10) || 0);
|
|
52
|
+
next.debounce = Math.max(0, Number.parseInt(next.debounce, 10) || 0);
|
|
53
|
+
next.limit = Math.max(1, Number.parseInt(next.limit, 10) || DEFAULT_OPTIONS.limit);
|
|
54
|
+
next.submitOnSelect = Boolean(next.submitOnSelect);
|
|
55
|
+
next.searchOnFocus = Boolean(next.searchOnFocus);
|
|
56
|
+
next.source = typeof next.source === "function" || Array.isArray(next.source) ? next.source : null;
|
|
57
|
+
next.onSelect = typeof next.onSelect === "function" ? next.onSelect : null;
|
|
58
|
+
return next;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function closeSearch(search) {
|
|
62
|
+
const data = API.get(search);
|
|
63
|
+
if (!data) return;
|
|
64
|
+
|
|
65
|
+
pgs(search).state.remove("open");
|
|
66
|
+
data.input.setAttribute("aria-expanded", "false");
|
|
67
|
+
data.input.removeAttribute("aria-activedescendant");
|
|
68
|
+
data.list.setAttribute("aria-hidden", "true");
|
|
69
|
+
data.setActiveIndex(-1);
|
|
70
|
+
OPEN_SEARCHES.delete(search);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function openSearch(search) {
|
|
74
|
+
const data = API.get(search);
|
|
75
|
+
if (!data || data.items().length === 0) return;
|
|
76
|
+
|
|
77
|
+
pgs(search).state.add("open");
|
|
78
|
+
data.input.setAttribute("aria-expanded", "true");
|
|
79
|
+
data.list.setAttribute("aria-hidden", "false");
|
|
80
|
+
OPEN_SEARCHES.add(search);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function PGS_search_init(root = document) {
|
|
84
|
+
getSearches(root).forEach(search => {
|
|
85
|
+
if (API.has(search)) return;
|
|
86
|
+
|
|
87
|
+
const input = search.querySelector('input[type="search"]');
|
|
88
|
+
const list = directPgsChild(search, "search-suggestions");
|
|
89
|
+
if (!input || !list) return;
|
|
90
|
+
|
|
91
|
+
const id = nextSearchId();
|
|
92
|
+
if (!input.id) input.id = `search-input-${id}`;
|
|
93
|
+
if (!list.id) list.id = `search-suggestions-${id}`;
|
|
94
|
+
|
|
95
|
+
input.setAttribute("role", "combobox");
|
|
96
|
+
input.setAttribute("aria-autocomplete", "list");
|
|
97
|
+
input.setAttribute("aria-haspopup", "listbox");
|
|
98
|
+
input.setAttribute("aria-controls", list.id);
|
|
99
|
+
input.setAttribute("aria-expanded", "false");
|
|
100
|
+
input.setAttribute("autocomplete", "off");
|
|
101
|
+
list.setAttribute("role", "listbox");
|
|
102
|
+
list.setAttribute("aria-labelledby", input.id);
|
|
103
|
+
list.setAttribute("aria-hidden", "true");
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
let options = { ...DEFAULT_OPTIONS };
|
|
107
|
+
let items = [];
|
|
108
|
+
let activeIndex = -1;
|
|
109
|
+
let timer = null;
|
|
110
|
+
let controller = null;
|
|
111
|
+
let requestNumber = 0;
|
|
112
|
+
|
|
113
|
+
function setLoading(loading) {
|
|
114
|
+
pgs(search).state.toggle("loading", loading);
|
|
115
|
+
input.setAttribute("aria-busy", String(loading));
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function setActiveIndex(index) {
|
|
119
|
+
activeIndex = index;
|
|
120
|
+
const elements = Array.from(list.querySelectorAll('[pgs~="search-suggestions-item"]'));
|
|
121
|
+
|
|
122
|
+
elements.forEach((element, itemIndex) => {
|
|
123
|
+
const selected = itemIndex === activeIndex;
|
|
124
|
+
element.setAttribute("aria-selected", String(selected));
|
|
125
|
+
pgs(element).state.toggle("selected", selected);
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
const active = elements[activeIndex];
|
|
129
|
+
if (active) {
|
|
130
|
+
input.setAttribute("aria-activedescendant", active.id);
|
|
131
|
+
active.scrollIntoView({ block: "nearest" });
|
|
132
|
+
} else {
|
|
133
|
+
input.removeAttribute("aria-activedescendant");
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function moveActive(step) {
|
|
138
|
+
if (!items.length) return;
|
|
139
|
+
|
|
140
|
+
let next = activeIndex;
|
|
141
|
+
for (let checked = 0; checked < items.length; checked += 1) {
|
|
142
|
+
next = (next + step + items.length) % items.length;
|
|
143
|
+
if (!items[next].disabled) {
|
|
144
|
+
setActiveIndex(next);
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function clear() {
|
|
151
|
+
items = [];
|
|
152
|
+
activeIndex = -1;
|
|
153
|
+
list.replaceChildren();
|
|
154
|
+
closeSearch(search);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
function cancel() {
|
|
158
|
+
if (timer !== null) window.clearTimeout(timer);
|
|
159
|
+
timer = null;
|
|
160
|
+
if (controller) controller.abort();
|
|
161
|
+
controller = null;
|
|
162
|
+
requestNumber += 1;
|
|
163
|
+
setLoading(false);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
function render(nextItems) {
|
|
167
|
+
items = Array.from(nextItems || [])
|
|
168
|
+
.map(normalizeItem)
|
|
169
|
+
.filter(Boolean)
|
|
170
|
+
.slice(0, options.limit);
|
|
171
|
+
|
|
172
|
+
const fragment = document.createDocumentFragment();
|
|
173
|
+
items.forEach((item, index) => {
|
|
174
|
+
const option = document.createElement("li");
|
|
175
|
+
pgs(option).add("search-suggestions-item");
|
|
176
|
+
pgs(option).add("flexRow");
|
|
177
|
+
option.id = `${list.id}-option-${index}`;
|
|
178
|
+
option.dataset.index = String(index);
|
|
179
|
+
option.setAttribute("role", "option");
|
|
180
|
+
option.setAttribute("aria-selected", "false");
|
|
181
|
+
option.setAttribute("aria-disabled", String(item.disabled));
|
|
182
|
+
option.innerHTML = '<i class="fa-solid fa-magnifying-glass"></i>' + item.label;
|
|
183
|
+
fragment.append(option);
|
|
184
|
+
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
activeIndex = -1;
|
|
188
|
+
list.replaceChildren(fragment);
|
|
189
|
+
pgs(search).state.remove("error");
|
|
190
|
+
|
|
191
|
+
if (items.length) openSearch(search);
|
|
192
|
+
else closeSearch(search);
|
|
193
|
+
|
|
194
|
+
return items;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
async function resolveSource(query, signal) {
|
|
198
|
+
if (Array.isArray(options.source)) {
|
|
199
|
+
const normalizedQuery = query.toLocaleLowerCase();
|
|
200
|
+
return options.source.filter(item => {
|
|
201
|
+
const normalized = normalizeItem(item);
|
|
202
|
+
return normalized && normalized.label.toLocaleLowerCase().includes(normalizedQuery);
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
if (typeof options.source !== "function") return [];
|
|
207
|
+
return await options.source({
|
|
208
|
+
query,
|
|
209
|
+
signal,
|
|
210
|
+
limit: options.limit,
|
|
211
|
+
element: search,
|
|
212
|
+
input,
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
async function runSearch(query = input.value) {
|
|
217
|
+
cancel();
|
|
218
|
+
clear();
|
|
219
|
+
|
|
220
|
+
const normalizedQuery = String(query ?? "").trim();
|
|
221
|
+
if (normalizedQuery.length < options.minLength || !options.source) return [];
|
|
222
|
+
|
|
223
|
+
const currentRequest = requestNumber;
|
|
224
|
+
controller = new AbortController();
|
|
225
|
+
const currentController = controller;
|
|
226
|
+
setLoading(true);
|
|
227
|
+
|
|
228
|
+
try {
|
|
229
|
+
const result = await resolveSource(normalizedQuery, currentController.signal);
|
|
230
|
+
if (currentRequest !== requestNumber || currentController.signal.aborted) return [];
|
|
231
|
+
return render(result);
|
|
232
|
+
} catch (error) {
|
|
233
|
+
if (error?.name === "AbortError") return [];
|
|
234
|
+
if (currentRequest !== requestNumber) return [];
|
|
235
|
+
|
|
236
|
+
clear();
|
|
237
|
+
pgs(search).state.add("error");
|
|
238
|
+
search.dispatchEvent(new CustomEvent("pgs:search:error", {
|
|
239
|
+
bubbles: true,
|
|
240
|
+
detail: { error, query: normalizedQuery },
|
|
241
|
+
}));
|
|
242
|
+
return [];
|
|
243
|
+
} finally {
|
|
244
|
+
if (controller === currentController) controller = null;
|
|
245
|
+
if (currentRequest === requestNumber) setLoading(false);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
function schedule() {
|
|
250
|
+
cancel();
|
|
251
|
+
clear();
|
|
252
|
+
pgs(search).state.remove("error");
|
|
253
|
+
|
|
254
|
+
if (input.value.trim().length < options.minLength || !options.source) return;
|
|
255
|
+
timer = window.setTimeout(() => {
|
|
256
|
+
timer = null;
|
|
257
|
+
runSearch(input.value);
|
|
258
|
+
}, options.debounce);
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
function select(index = activeIndex, submit = options.submitOnSelect) {
|
|
262
|
+
const item = items[index];
|
|
263
|
+
if (!item || item.disabled) return null;
|
|
264
|
+
|
|
265
|
+
input.value = item.value;
|
|
266
|
+
cancel();
|
|
267
|
+
clear();
|
|
268
|
+
|
|
269
|
+
const detail = { item, index, value: item.value, input, element: search };
|
|
270
|
+
search.dispatchEvent(new CustomEvent("pgs:search:select", { bubbles: true, detail }));
|
|
271
|
+
options.onSelect?.(detail);
|
|
272
|
+
|
|
273
|
+
input.focus();
|
|
274
|
+
if (submit && typeof search.requestSubmit === "function") search.requestSubmit();
|
|
275
|
+
return item;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
function configure(nextOptions = {}) {
|
|
279
|
+
options = normalizeOptions(options, nextOptions);
|
|
280
|
+
return api;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
function onInput() {
|
|
284
|
+
schedule();
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
function onFocus() {
|
|
288
|
+
if (items.length) openSearch(search);
|
|
289
|
+
else if (options.searchOnFocus) schedule();
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
function onKeydown(event) {
|
|
293
|
+
if (event.key === "ArrowDown") {
|
|
294
|
+
if (!pgs(search).state.contains("open")) schedule();
|
|
295
|
+
if (items.length) {
|
|
296
|
+
event.preventDefault();
|
|
297
|
+
moveActive(1);
|
|
298
|
+
}
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
if (event.key === "ArrowUp" && items.length) {
|
|
303
|
+
event.preventDefault();
|
|
304
|
+
moveActive(-1);
|
|
305
|
+
return;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
if (event.key === "Enter" && activeIndex >= 0) {
|
|
309
|
+
event.preventDefault();
|
|
310
|
+
select(activeIndex);
|
|
311
|
+
return;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
if (event.key === "Escape") {
|
|
315
|
+
event.preventDefault();
|
|
316
|
+
cancel();
|
|
317
|
+
closeSearch(search);
|
|
318
|
+
return;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
if (event.key === "Tab") closeSearch(search);
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
function onListPointerDown(event) {
|
|
325
|
+
const option = event.target.closest('[pgs~="search-suggestions-item"]');
|
|
326
|
+
if (!option || !list.contains(option)) return;
|
|
327
|
+
event.preventDefault();
|
|
328
|
+
select(Number.parseInt(option.dataset.index, 10));
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
function onSubmit() {
|
|
332
|
+
cancel();
|
|
333
|
+
closeSearch(search);
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
function destroy() {
|
|
337
|
+
cancel();
|
|
338
|
+
clear();
|
|
339
|
+
input.removeEventListener("input", onInput);
|
|
340
|
+
input.removeEventListener("focus", onFocus);
|
|
341
|
+
input.removeEventListener("keydown", onKeydown);
|
|
342
|
+
list.removeEventListener("pointerdown", onListPointerDown);
|
|
343
|
+
search.removeEventListener("submit", onSubmit);
|
|
344
|
+
API.delete(search);
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
const api = {
|
|
348
|
+
element: search,
|
|
349
|
+
input,
|
|
350
|
+
list,
|
|
351
|
+
configure,
|
|
352
|
+
setSource: source => configure({ source }),
|
|
353
|
+
search: runSearch,
|
|
354
|
+
open: () => openSearch(search),
|
|
355
|
+
close: () => closeSearch(search),
|
|
356
|
+
clear,
|
|
357
|
+
cancel,
|
|
358
|
+
select,
|
|
359
|
+
refresh: () => runSearch(input.value),
|
|
360
|
+
destroy,
|
|
361
|
+
items: () => [...items],
|
|
362
|
+
isOpen: () => pgs(search).state.contains("open"),
|
|
363
|
+
isLoading: () => pgs(search).state.contains("loading"),
|
|
364
|
+
setActiveIndex,
|
|
365
|
+
};
|
|
366
|
+
|
|
367
|
+
input.addEventListener("input", onInput);
|
|
368
|
+
input.addEventListener("focus", onFocus);
|
|
369
|
+
input.addEventListener("keydown", onKeydown);
|
|
370
|
+
list.addEventListener("pointerdown", onListPointerDown);
|
|
371
|
+
search.addEventListener("submit", onSubmit);
|
|
372
|
+
API.set(search, api);
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
document.addEventListener("pointerdown", event => {
|
|
377
|
+
OPEN_SEARCHES.forEach(search => {
|
|
378
|
+
if (!search.contains(event.target)) closeSearch(search);
|
|
379
|
+
});
|
|
380
|
+
});
|
|
381
|
+
|
|
382
|
+
PGS_search_init();
|
|
383
|
+
|
|
384
|
+
export function PGS_search_api(selector) {
|
|
385
|
+
return API.get(selector);
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
export const PGS_search = {
|
|
389
|
+
init: PGS_search_init,
|
|
390
|
+
api: PGS_search_api,
|
|
391
|
+
};
|
|
@@ -4,6 +4,7 @@ export { pgs } from "./_pgs.js";
|
|
|
4
4
|
|
|
5
5
|
//= BASE
|
|
6
6
|
import "./base/_darkmode.js";
|
|
7
|
+
import "./base/_svg.js";
|
|
7
8
|
import "./base/_object.js";
|
|
8
9
|
|
|
9
10
|
//= CN
|
|
@@ -11,6 +12,7 @@ import "./components/_accordion.js";
|
|
|
11
12
|
import "./components/_dropdown.js";
|
|
12
13
|
import "./components/_menu.js"
|
|
13
14
|
import "./components/_modals.js";
|
|
15
|
+
import "./components/_search.js";
|
|
14
16
|
import "./components/_slides.js"
|
|
15
17
|
import "./components/_steps.js";
|
|
16
18
|
import "./components/_stepTabs.js";
|
|
@@ -93,9 +93,32 @@ function headerHeight() {
|
|
|
93
93
|
document.documentElement.style.setProperty("--heightOfHeader", `${height}px`);
|
|
94
94
|
document.documentElement.style.setProperty("--heightOfHeaderScroll", `${scrollHeight}px`);
|
|
95
95
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
96
|
+
|
|
97
|
+
// Il modulo può essere caricato nel footer: rimanda il primo calcolo al frame
|
|
98
|
+
// successivo, quando il browser ha già composto l'header, senza aspettare il
|
|
99
|
+
// caricamento completo della pagina.
|
|
100
|
+
let headerHeightRafId = 0;
|
|
101
|
+
function scheduleHeaderHeight() {
|
|
102
|
+
if (headerHeightRafId) return;
|
|
103
|
+
|
|
104
|
+
headerHeightRafId = requestAnimationFrame(() => {
|
|
105
|
+
headerHeightRafId = 0;
|
|
106
|
+
headerHeight();
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (header) {
|
|
111
|
+
const headerHeightObserver = new ResizeObserver(scheduleHeaderHeight);
|
|
112
|
+
headerHeightObserver.observe(header);
|
|
113
|
+
|
|
114
|
+
// Un font web può modificare la larghezza del menu e quindi l'altezza
|
|
115
|
+
// dell'header, anche dopo il primo frame.
|
|
116
|
+
document.fonts?.ready?.then(scheduleHeaderHeight);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
scheduleHeaderHeight();
|
|
120
|
+
window.addEventListener("resize", scheduleHeaderHeight);
|
|
121
|
+
window.addEventListener("scroll", scheduleHeaderHeight, { passive: true });
|
|
99
122
|
|
|
100
123
|
|
|
101
124
|
|
|
@@ -125,7 +148,3 @@ window.addEventListener("scroll", () => {
|
|
|
125
148
|
|
|
126
149
|
});
|
|
127
150
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
:root {
|
|
6
6
|
color-scheme: light;
|
|
7
7
|
|
|
8
|
-
&[
|
|
8
|
+
&[pgs-state~=darkmode] {
|
|
9
9
|
color-scheme: dark;
|
|
10
10
|
}
|
|
11
11
|
|
|
@@ -21,10 +21,10 @@
|
|
|
21
21
|
--color-white-transparent: color-mix(in srgb, var(--color-white) 50%, transparent 100%);
|
|
22
22
|
--color-black-transparent: color-mix(in srgb, var(--color-black) 50%, transparent 100%);
|
|
23
23
|
--color-text: light-dark(#4a4a4a, #e3e3e3);
|
|
24
|
-
--color-box: light-dark(#F8F8F8, #
|
|
25
|
-
--color-boxDark: light-dark(#
|
|
26
|
-
--color-box-transparent: light-dark(color-mix(in srgb, #eeeeee 50%, transparent 50%), color-mix(in srgb, #
|
|
27
|
-
--color-boxDark-transparent: light-dark(color-mix(in srgb, #
|
|
24
|
+
--color-box: light-dark(#F8F8F8, #222121);
|
|
25
|
+
--color-boxDark: light-dark(#222121, #F8F8F8);
|
|
26
|
+
--color-box-transparent: light-dark(color-mix(in srgb, #eeeeee 50%, transparent 50%), color-mix(in srgb, #222121 50%, transparent 50%));
|
|
27
|
+
--color-boxDark-transparent: light-dark(color-mix(in srgb, #222121 50%, transparent 50%), color-mix(in srgb, #eeeeee 50%, transparent 50%));
|
|
28
28
|
--color-linkBackgorud: light-dark(#a0dbff, #002a44);
|
|
29
29
|
--color-background: light-dark(#ffffff, #080808);
|
|
30
30
|
--color-whiteFixed: #FFFFFF;
|
|
@@ -19,7 +19,8 @@
|
|
|
19
19
|
--text-shadow: 0px 0px 50px #000000;
|
|
20
20
|
--backdrop: #0000003e;
|
|
21
21
|
--blur: blur(20px);
|
|
22
|
-
--page-top: calc(var(--
|
|
22
|
+
--page-top: calc(var(--heightOfHeader) + (var(--gap-elements)*2));
|
|
23
|
+
--page-topScroll: calc(var(--heightOfHeaderScroll) + (var(--gap-elements)*2));
|
|
23
24
|
--page-width: 1280px;
|
|
24
25
|
--page-space: clamp(var(--padding-page), calc((100% - var(--section-width)) / 2 + var(--padding-page)), 100%);
|
|
25
26
|
--gap-texts: 1.0rem;
|
|
@@ -32,7 +33,8 @@
|
|
|
32
33
|
--fa-size: inherit;
|
|
33
34
|
--focus-visible: 3px solid var(--color-link);
|
|
34
35
|
|
|
35
|
-
--heightOfHeader:
|
|
36
|
+
--heightOfHeader: 6.8rem; ///preload fittizio
|
|
37
|
+
--heightOfHeaderScroll: 6.8rem; ///preload fittizio
|
|
36
38
|
|
|
37
39
|
//- mobile
|
|
38
40
|
@media (max-width: $mobile) {
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
--dropdown-background: var(--color-box);
|
|
4
4
|
--dropdown-color: var(--color-black);
|
|
5
5
|
--dropdown-border: var(--border-complete);
|
|
6
|
+
--dropdown-borderRadius: var(--dropdown-padding);
|
|
6
7
|
--dropdown-padding: 1rem;
|
|
7
8
|
--dropdown-inline-size: max-content;
|
|
8
9
|
--dropdown-max-inline-size: min(400px, calc(100vw - 16px));
|
|
@@ -28,7 +29,7 @@
|
|
|
28
29
|
overflow: auto;
|
|
29
30
|
padding: var(--dropdown-padding);
|
|
30
31
|
border: var(--dropdown-border);
|
|
31
|
-
border-radius:
|
|
32
|
+
border-radius: var(--dropdown-borderRadius);
|
|
32
33
|
background: var(--dropdown-background);
|
|
33
34
|
color: var(--dropdown-color);
|
|
34
35
|
}
|
|
@@ -8,12 +8,12 @@
|
|
|
8
8
|
--logo-finter: invert(1) hue-rotate(180deg) brightness(1.5);
|
|
9
9
|
|
|
10
10
|
//== DARKMODE
|
|
11
|
-
@at-root [
|
|
11
|
+
@at-root [pgs-state~=darkmode] #{&}[pgs-option~="logoDarkmode"] [pgs~="logo-image"] {
|
|
12
12
|
filter: var(--logo-finter);
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
//== FIXED DARKMODE
|
|
16
|
-
&[pgs
|
|
16
|
+
&[pgs-option~="logoDarkmodeFixed"] [pgs~="logo-image"] {
|
|
17
17
|
filter: var(--logo-finter);
|
|
18
18
|
}
|
|
19
19
|
|
|
@@ -10,10 +10,6 @@
|
|
|
10
10
|
row-gap: 1.0rem;
|
|
11
11
|
flex-wrap: nowrap;
|
|
12
12
|
|
|
13
|
-
ul {
|
|
14
|
-
display: none;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
13
|
//== Content
|
|
18
14
|
>li {
|
|
19
15
|
>a {
|
|
@@ -30,6 +26,20 @@
|
|
|
30
26
|
li {
|
|
31
27
|
width: -webkit-fill-available;
|
|
32
28
|
}
|
|
29
|
+
|
|
30
|
+
&[pgs-state~=open]>ul {
|
|
31
|
+
display: flex;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
//== submenu
|
|
36
|
+
ul {
|
|
37
|
+
display: none;
|
|
38
|
+
flex-direction: column;
|
|
39
|
+
gap: var(--gap-texts);
|
|
40
|
+
--dropdown-borderRadius: calc(var(--border-radius-input) + var(--dropdown-padding));
|
|
41
|
+
--dropdown-background: var(--color-box-transparent);
|
|
42
|
+
--dropdown-display: flex;
|
|
33
43
|
}
|
|
34
44
|
}
|
|
35
45
|
|
|
@@ -45,8 +55,12 @@
|
|
|
45
55
|
cursor: pointer;
|
|
46
56
|
translate: -15px;
|
|
47
57
|
|
|
48
|
-
&[aria-expanded="true"]
|
|
49
|
-
|
|
58
|
+
&[aria-expanded="true"] {
|
|
59
|
+
--button-background: var(--color-primary);
|
|
60
|
+
|
|
61
|
+
span {
|
|
62
|
+
rotate: 180deg;
|
|
63
|
+
}
|
|
50
64
|
}
|
|
51
65
|
|
|
52
66
|
span {
|
|
@@ -67,25 +81,9 @@
|
|
|
67
81
|
|
|
68
82
|
//=== Sub menu
|
|
69
83
|
>li:has(ul) {
|
|
70
|
-
--dropdown-display: flex;
|
|
71
84
|
display: flex;
|
|
72
85
|
gap: 0.2rem;
|
|
73
86
|
flex-wrap: nowrap;
|
|
74
|
-
|
|
75
|
-
>a {
|
|
76
|
-
border-radius: var(--border-radius-input);
|
|
77
|
-
// box-shadow: var(--box-shadow);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
ul {
|
|
81
|
-
li a {
|
|
82
|
-
min-width: 100% !important;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
&[pgs-state~=open]>ul {
|
|
87
|
-
display: flex;
|
|
88
|
-
}
|
|
89
87
|
}
|
|
90
88
|
}
|
|
91
89
|
}
|
|
@@ -112,13 +110,8 @@
|
|
|
112
110
|
align-items: center;
|
|
113
111
|
position: relative;
|
|
114
112
|
|
|
115
|
-
>a {
|
|
116
|
-
max-width: calc(100% - var(--gap-texts) - 40px);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
113
|
>ul {
|
|
120
114
|
flex-basis: 100%;
|
|
121
|
-
// --dropdown-maxwidth: 100%;
|
|
122
115
|
}
|
|
123
116
|
|
|
124
117
|
&:not([pgs-state~=open]) ul {
|
|
@@ -79,7 +79,7 @@ dialog[pgs~="modal-dialog"] {
|
|
|
79
79
|
&:has([pgs~="modal-dialog-content-scroll"]) {
|
|
80
80
|
max-height: calc(90svh - var(--heightOfHeader));
|
|
81
81
|
overflow: hidden;
|
|
82
|
-
|
|
82
|
+
|
|
83
83
|
[pgs~="modal-dialog-content-scroll"] {
|
|
84
84
|
padding-top: calc(var(--padding) / 2);
|
|
85
85
|
overflow: auto;
|
|
@@ -101,6 +101,16 @@ dialog[pgs~="modal-dialog"] {
|
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
//#OPTION
|
|
104
|
+
//== topLevel
|
|
105
|
+
&[pgs-option~="topLevel"] {
|
|
106
|
+
align-items: center;
|
|
107
|
+
padding-inline: 1rem;
|
|
108
|
+
|
|
109
|
+
[pgs~="modal-dialog-content"] {
|
|
110
|
+
width: min(600px, 100%);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
104
114
|
//== LEFT
|
|
105
115
|
&[pgs-option~="left"] {
|
|
106
116
|
[pgs~="modal-dialog-content"] {
|