@po-ui/ng-components 19.39.27 → 19.39.29

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.
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Input, Directive, ChangeDetectionStrategy, Component, NgModule, InjectionToken, TemplateRef, HostBinding, ViewChild, Optional, Inject, Injectable, EventEmitter, Output, ElementRef, SecurityContext, HostListener, inject, ChangeDetectorRef, ContentChildren, ViewChildren, input, forwardRef, Renderer2, IterableDiffers, ViewContainerRef, ContentChild, Pipe, Injector, provideAppInitializer } from '@angular/core';
2
+ import { Input, Directive, ChangeDetectionStrategy, Component, NgModule, InjectionToken, TemplateRef, HostBinding, ViewChild, Optional, Inject, Injectable, EventEmitter, Output, ElementRef, SecurityContext, HostListener, inject, ChangeDetectorRef, ContentChildren, ViewChildren, input, forwardRef, Renderer2, IterableDiffers, ViewContainerRef, ContentChild, Pipe, CSP_NONCE, Injector, provideAppInitializer } from '@angular/core';
3
3
  import * as i1 from '@angular/common';
4
4
  import { CommonModule, CurrencyPipe, DecimalPipe, DOCUMENT, TitleCasePipe, DatePipe, NgOptimizedImage, Location } from '@angular/common';
5
5
  import * as i2 from '@angular/platform-browser';
@@ -466,6 +466,7 @@ class PoIconComponent {
466
466
  }
467
467
  else if (value instanceof TemplateRef) {
468
468
  this._icon = value;
469
+ this.class = '';
469
470
  this.hostPIcon = null;
470
471
  }
471
472
  }
@@ -18877,6 +18878,30 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImpo
18877
18878
  }]
18878
18879
  }] });
18879
18880
 
18881
+ /**
18882
+ * @docsPrivate
18883
+ *
18884
+ * Aplica o nonce da Content-Security-Policy (token `CSP_NONCE` do Angular) a um elemento criado em tempo de execução
18885
+ * (ex.: `<style>`), para que ele seja aceito por políticas sem `'unsafe-inline'`.
18886
+ *
18887
+ * Deve ser chamado antes de o elemento ser inserido no DOM. Sem nonce configurado, o elemento permanece inalterado.
18888
+ *
18889
+ * @param element Elemento que receberá o nonce.
18890
+ * @param nonce Valor do `CSP_NONCE`. `null`, `undefined` ou vazio não alteram o elemento.
18891
+ * @param renderer (Opcional) Renderer usado para definir o atributo. Sem ele, é usado `element.setAttribute`.
18892
+ */
18893
+ function applyCspNonce(element, nonce, renderer) {
18894
+ if (!element || !nonce) {
18895
+ return;
18896
+ }
18897
+ if (renderer) {
18898
+ renderer.setAttribute(element, 'nonce', nonce);
18899
+ }
18900
+ else {
18901
+ element.setAttribute('nonce', nonce);
18902
+ }
18903
+ }
18904
+
18880
18905
  /**
18881
18906
  * @description
18882
18907
  *
@@ -18929,8 +18954,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImpo
18929
18954
  *
18930
18955
  */
18931
18956
  class PoMediaQueryService {
18957
+ cspNonce;
18932
18958
  renderer;
18933
- constructor(rendererFactory) {
18959
+ constructor(rendererFactory, cspNonce) {
18960
+ this.cspNonce = cspNonce;
18934
18961
  this.renderer = rendererFactory.createRenderer(null, null);
18935
18962
  }
18936
18963
  /**
@@ -18953,6 +18980,7 @@ class PoMediaQueryService {
18953
18980
  }
18954
18981
  createStyleElement() {
18955
18982
  const styleElement = this.renderer.createElement('style');
18983
+ applyCspNonce(styleElement, this.cspNonce, this.renderer);
18956
18984
  this.renderer.appendChild(document.head, styleElement);
18957
18985
  return styleElement;
18958
18986
  }
@@ -19010,7 +19038,7 @@ class PoMediaQueryService {
19010
19038
  return existingQuery;
19011
19039
  }
19012
19040
  }
19013
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: PoMediaQueryService, deps: [{ token: i0.RendererFactory2 }], target: i0.ɵɵFactoryTarget.Injectable });
19041
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: PoMediaQueryService, deps: [{ token: i0.RendererFactory2 }, { token: CSP_NONCE, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
19014
19042
  static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: PoMediaQueryService, providedIn: 'root' });
19015
19043
  }
19016
19044
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: PoMediaQueryService, decorators: [{
@@ -19018,7 +19046,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImpo
19018
19046
  args: [{
19019
19047
  providedIn: 'root'
19020
19048
  }]
19021
- }], ctorParameters: () => [{ type: i0.RendererFactory2 }] });
19049
+ }], ctorParameters: () => [{ type: i0.RendererFactory2 }, { type: undefined, decorators: [{
19050
+ type: Optional
19051
+ }, {
19052
+ type: Inject,
19053
+ args: [CSP_NONCE]
19054
+ }] }] });
19022
19055
 
19023
19056
  /**
19024
19057
  * @description
@@ -20192,14 +20225,16 @@ const poThemeDefault = {
20192
20225
  */
20193
20226
  class PoThemeService {
20194
20227
  document;
20228
+ cspNonce;
20195
20229
  renderer;
20196
20230
  theme;
20197
20231
  _iconToken;
20198
20232
  get iconNameLib() {
20199
20233
  return this._iconToken.NAME_LIB;
20200
20234
  }
20201
- constructor(document, rendererFactory, value) {
20235
+ constructor(document, rendererFactory, value, cspNonce) {
20202
20236
  this.document = document;
20237
+ this.cspNonce = cspNonce;
20203
20238
  this.renderer = rendererFactory.createRenderer(null, null);
20204
20239
  this._iconToken = value ?? AnimaliaIconDictionary;
20205
20240
  this.setDefaultBaseStyle();
@@ -20430,6 +20465,7 @@ class PoThemeService {
20430
20465
  let styleElement = this.document.head.querySelector('#baseStyle');
20431
20466
  if (!styleElement) {
20432
20467
  styleElement = this.renderer.createElement('style');
20468
+ applyCspNonce(styleElement, this.cspNonce, this.renderer);
20433
20469
  styleElement.id = 'baseStyle';
20434
20470
  this.renderer.appendChild(styleElement, this.renderer.createText(styleCss));
20435
20471
  this.renderer.insertBefore(this.document.head, styleElement, this.document.head.firstChild);
@@ -20606,6 +20642,7 @@ class PoThemeService {
20606
20642
  */
20607
20643
  createStyleElement(css, id) {
20608
20644
  const styleElement = this.renderer.createElement('style');
20645
+ applyCspNonce(styleElement, this.cspNonce, this.renderer);
20609
20646
  styleElement.id = id;
20610
20647
  this.renderer.appendChild(styleElement, this.renderer.createText(css));
20611
20648
  return styleElement;
@@ -20785,7 +20822,7 @@ class PoThemeService {
20785
20822
  // result: :root[class*="-dark-AA"]Add commentMore actions
20786
20823
  this.setPerComponentAndOnRoot({ type: PoThemeTypeEnum.dark, a11y: PoThemeA11yEnum.AA }, poThemeDefaultDarkValuesAA.perComponent, poThemeDefaultDarkValuesAA.onRoot);
20787
20824
  }
20788
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: PoThemeService, deps: [{ token: DOCUMENT }, { token: i0.RendererFactory2 }, { token: ICONS_DICTIONARY, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
20825
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: PoThemeService, deps: [{ token: DOCUMENT }, { token: i0.RendererFactory2 }, { token: ICONS_DICTIONARY, optional: true }, { token: CSP_NONCE, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
20789
20826
  static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: PoThemeService, providedIn: 'root' });
20790
20827
  }
20791
20828
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: PoThemeService, decorators: [{
@@ -20801,6 +20838,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImpo
20801
20838
  }, {
20802
20839
  type: Inject,
20803
20840
  args: [ICONS_DICTIONARY]
20841
+ }] }, { type: undefined, decorators: [{
20842
+ type: Optional
20843
+ }, {
20844
+ type: Inject,
20845
+ args: [CSP_NONCE]
20804
20846
  }] }] });
20805
20847
 
20806
20848
  /**