@massimo-cassandro/minimo 0.12.13 → 0.12.15

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@massimo-cassandro/minimo",
3
- "version": "0.12.13",
3
+ "version": "0.12.15",
4
4
  "description": "Light css framework & utilities",
5
5
  "type": "module",
6
6
  "homepage": "https://github.com/massimo-cassandro/minimo#readme",
@@ -29,7 +29,7 @@ export function parseDomString(domString) {
29
29
 
30
30
  // versione con groups
31
31
  // const regex = new RegExp(
32
- // /^(?<tag>[a-zA-Z]+)?/.source + // tag
32
+ // /^(?<tag>[a-zA-Z][a-zA-Z0-9-]*)?/.source + // tag
33
33
  // /(?:#(?<id>[a-zA-Z0-9_-]+))?/.source + // id
34
34
  // /(?<classes>(?:\.[a-zA-Z0-9_-]+)*)?/.source + // classi
35
35
  // /(?<attrs>[([{].*?[)\]}])?/.source + // attrs
@@ -37,11 +37,11 @@ export function parseDomString(domString) {
37
37
  // );
38
38
 
39
39
  const regex = new RegExp(
40
- /^([a-zA-Z]+)?/.source + // tag
41
- /(?:#([a-zA-Z0-9_-]+))?/.source + // id
42
- /((?:\.[a-zA-Z0-9_-]+)*)?/.source + // classi
43
- /([([{].*?[)\]}])?/.source + // attrs
44
- /(?: +(.*))?$/.source // content
40
+ /^([a-zA-Z][a-zA-Z0-9-]*)?/.source + // tag (accetta anche nomi di web components)
41
+ /(?:#([a-zA-Z0-9_-]+))?/.source + // id
42
+ /((?:\.[a-zA-Z0-9_-]+)*)?/.source + // classi
43
+ /([([{].*?[)\]}])?/.source + // attrs
44
+ /(?: +(.*))?$/.source // content
45
45
  );
46
46
 
47
47
  const matches = domString.match(regex);
@@ -94,7 +94,16 @@ import caretRightIcon from '../../icons/caret-right.svg?inline';
94
94
  * di sessione `sd-pag`. Se il referrer non è tra
95
95
  * quelli indicati, il cookie viene eliminato.
96
96
  * Confronto su `pathname` (query string e hash ignorati).
97
- * Esempio: `['/utenti', '/utenti/nuovo']`
97
+ * Esempio: `['/utenti']`
98
+ * NB: il match è positivo anche se il referrer è parte di una delle stringhe permesse
99
+ * quindi, ad esempio, `['/utenti']` intercetta sia `/utenti` che `/utenti/1234`
100
+ *
101
+
102
+ ------------ DA VALUTARE NON IMPLEMENTATO -----------
103
+ * @param {string[]} refsCallback callback da eseguire in seguito al match di refs.
104
+ * È invocato con l'argomento isRef (true | false) che indica se la pagina referrer
105
+ * è tra quelle mappate in refs, quindi `['/utenti']`.
106
+ * Utilizzabile solo nella configurazione via script
98
107
  */
99
108
 
100
109
 
@@ -401,16 +410,14 @@ class SimpleDatatableAdapter extends HTMLElement {
401
410
  return false;
402
411
  }
403
412
  }
404
-
405
413
  if (!Array.isArray(allowed) || !allowed.length || !document.referrer) {
406
414
  return false;
407
415
  }
408
-
409
416
  const referrerPath = new URL(document.referrer).pathname;
410
417
 
411
418
  // Ritorna true se il path del referrer è contenuto in una delle stringhe di 'allowed'
412
419
  return allowed.some(allowedUrl =>
413
- typeof allowedUrl === 'string' && allowedUrl.includes(referrerPath)
420
+ (typeof allowedUrl === 'string') && (referrerPath.includes(allowedUrl))
414
421
  );
415
422
  }
416
423
 
@@ -740,6 +747,8 @@ class SimpleDatatableAdapter extends HTMLElement {
740
747
  .forEach(btn => btn.classList.add(styles.hasSvg));
741
748
 
742
749
  // Ripristino pagina dal cookie di sessione (se referrer autorizzato)
750
+ // const isRefUrl = this._isReferrer(), refsCallback = this._getParam('refsCallback', null);
751
+ // if (isRefUrl) {
743
752
  if (this._isReferrer()) {
744
753
  const savedPage = this._readPageCookie();
745
754
  if (savedPage !== null) {
@@ -749,6 +758,10 @@ class SimpleDatatableAdapter extends HTMLElement {
749
758
  this._deletePageCookie();
750
759
  }
751
760
 
761
+ // if(refsCallback && typeof refsCallback === 'function') {
762
+ // refsCallback(isRefUrl);
763
+ // }
764
+
752
765
  // Applica eventuale filtro contestuale passato via reload({ search: … })
753
766
  // Lo facciamo qui, dentro datatable.init, per essere certi che
754
767
  // simple-datatables abbia completato il render dei nuovi dati.