@fluxhub/fluxhub-lib 19.0.218 → 19.0.219

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.
@@ -32000,10 +32000,13 @@ class win_select_level_v2 {
32000
32000
  this.toastr = toastr;
32001
32001
  this._tsr = _tsr;
32002
32002
  this.data = data;
32003
+ // Lo sfondo del pulsante e' fisso (#fafafa): un colore chiaro rende il testo o il
32004
+ // filetto invisibili. `color` di default vale #ededed su molte configurazioni, quindi
32005
+ // non basta il controllo "assente": va scartato anche se troppo chiaro.
32003
32006
  this.trans = data.map((v) => {
32004
- if (!v.color)
32007
+ if (!v.color || this.isLight(v.color))
32005
32008
  v.color = '#1e2755';
32006
- if (!v.color_font)
32009
+ if (!v.color_font || this.isLight(v.color_font))
32007
32010
  v.color_font = '#1e2755';
32008
32011
  return v;
32009
32012
  });
@@ -32020,6 +32023,21 @@ class win_select_level_v2 {
32020
32023
  * ("check"). Se manca lo stile assume "fa-solid". Gestisce anche i vecchi
32021
32024
  * valori FontAwesome 4 ("fa fa-check").
32022
32025
  */
32026
+ /**
32027
+ * true se il colore e' troppo chiaro per stare su #fafafa.
32028
+ * Luminanza percettiva (ITU-R BT.601): il verde pesa piu' del blu.
32029
+ */
32030
+ isLight(hex) {
32031
+ const h = (hex || '').replace('#', '').trim();
32032
+ if (h.length !== 3 && h.length !== 6)
32033
+ return false;
32034
+ const f = h.length === 3 ? h.split('').map((c) => c + c).join('') : h;
32035
+ const n = parseInt(f, 16);
32036
+ if (isNaN(n))
32037
+ return false;
32038
+ const r = (n >> 16) & 255, g = (n >> 8) & 255, b = n & 255;
32039
+ return (0.299 * r + 0.587 * g + 0.114 * b) > 186;
32040
+ }
32023
32041
  iconClass(v) {
32024
32042
  const raw = (v || "").trim();
32025
32043
  if (!raw)
@@ -32027,8 +32045,11 @@ class win_select_level_v2 {
32027
32045
  // gia` una classe completa con lo stile (solid/brands/regular/light/thin/duotone/sharp)
32028
32046
  if (/\bfa-(solid|brands|regular|light|thin|duotone|sharp)\b/.test(raw))
32029
32047
  return raw;
32030
- // vecchia sintassi FA4 "fa fa-check" -> usala cosi` com'e`
32031
- if (/\bfa\b/.test(raw))
32048
+ // vecchia sintassi FA4 "fa fa-check" -> usala cosi` com'e`.
32049
+ // NB: serve il token "fa" ISOLATO. Con /\bfa\b/ anche "fa-check" matchava (il '-' e'
32050
+ // un confine di parola), quindi tornava senza stile e FontAwesome 5+ non la rendeva:
32051
+ // nel dialog si vedeva un quadratino vuoto.
32052
+ if (/(^|\s)fa(\s|$)/.test(raw))
32032
32053
  return raw;
32033
32054
  // nome icona, con o senza prefisso "fa-" -> assume lo stile solid
32034
32055
  const name = raw.startsWith("fa-") ? raw : "fa-" + raw;
@@ -32073,7 +32094,7 @@ class win_select_level_v2 {
32073
32094
  [style.border-color]="app.background_color || '#ddd'"
32074
32095
  [style.border-left-color]="app.color"
32075
32096
  [style.background-color]="'#fafafa'"
32076
- [style.color]="app.color"
32097
+ [style.color]="app.color_font"
32077
32098
  (click)="sel(app)">
32078
32099
  <i *ngIf="app.icon && app.icon!=''" [ngClass]="iconClass(app.icon)" aria-hidden="true"></i>
32079
32100
  <span>{{ app.description | translate }}</span>
@@ -32105,7 +32126,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImpo
32105
32126
  [style.border-color]="app.background_color || '#ddd'"
32106
32127
  [style.border-left-color]="app.color"
32107
32128
  [style.background-color]="'#fafafa'"
32108
- [style.color]="app.color"
32129
+ [style.color]="app.color_font"
32109
32130
  (click)="sel(app)">
32110
32131
  <i *ngIf="app.icon && app.icon!=''" [ngClass]="iconClass(app.icon)" aria-hidden="true"></i>
32111
32132
  <span>{{ app.description | translate }}</span>