@po-ui/ng-components 19.39.28 → 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';
@@ -18878,6 +18878,30 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImpo
18878
18878
  }]
18879
18879
  }] });
18880
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
+
18881
18905
  /**
18882
18906
  * @description
18883
18907
  *
@@ -18930,8 +18954,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImpo
18930
18954
  *
18931
18955
  */
18932
18956
  class PoMediaQueryService {
18957
+ cspNonce;
18933
18958
  renderer;
18934
- constructor(rendererFactory) {
18959
+ constructor(rendererFactory, cspNonce) {
18960
+ this.cspNonce = cspNonce;
18935
18961
  this.renderer = rendererFactory.createRenderer(null, null);
18936
18962
  }
18937
18963
  /**
@@ -18954,6 +18980,7 @@ class PoMediaQueryService {
18954
18980
  }
18955
18981
  createStyleElement() {
18956
18982
  const styleElement = this.renderer.createElement('style');
18983
+ applyCspNonce(styleElement, this.cspNonce, this.renderer);
18957
18984
  this.renderer.appendChild(document.head, styleElement);
18958
18985
  return styleElement;
18959
18986
  }
@@ -19011,7 +19038,7 @@ class PoMediaQueryService {
19011
19038
  return existingQuery;
19012
19039
  }
19013
19040
  }
19014
- 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 });
19015
19042
  static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: PoMediaQueryService, providedIn: 'root' });
19016
19043
  }
19017
19044
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: PoMediaQueryService, decorators: [{
@@ -19019,7 +19046,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImpo
19019
19046
  args: [{
19020
19047
  providedIn: 'root'
19021
19048
  }]
19022
- }], ctorParameters: () => [{ type: i0.RendererFactory2 }] });
19049
+ }], ctorParameters: () => [{ type: i0.RendererFactory2 }, { type: undefined, decorators: [{
19050
+ type: Optional
19051
+ }, {
19052
+ type: Inject,
19053
+ args: [CSP_NONCE]
19054
+ }] }] });
19023
19055
 
19024
19056
  /**
19025
19057
  * @description
@@ -20193,14 +20225,16 @@ const poThemeDefault = {
20193
20225
  */
20194
20226
  class PoThemeService {
20195
20227
  document;
20228
+ cspNonce;
20196
20229
  renderer;
20197
20230
  theme;
20198
20231
  _iconToken;
20199
20232
  get iconNameLib() {
20200
20233
  return this._iconToken.NAME_LIB;
20201
20234
  }
20202
- constructor(document, rendererFactory, value) {
20235
+ constructor(document, rendererFactory, value, cspNonce) {
20203
20236
  this.document = document;
20237
+ this.cspNonce = cspNonce;
20204
20238
  this.renderer = rendererFactory.createRenderer(null, null);
20205
20239
  this._iconToken = value ?? AnimaliaIconDictionary;
20206
20240
  this.setDefaultBaseStyle();
@@ -20431,6 +20465,7 @@ class PoThemeService {
20431
20465
  let styleElement = this.document.head.querySelector('#baseStyle');
20432
20466
  if (!styleElement) {
20433
20467
  styleElement = this.renderer.createElement('style');
20468
+ applyCspNonce(styleElement, this.cspNonce, this.renderer);
20434
20469
  styleElement.id = 'baseStyle';
20435
20470
  this.renderer.appendChild(styleElement, this.renderer.createText(styleCss));
20436
20471
  this.renderer.insertBefore(this.document.head, styleElement, this.document.head.firstChild);
@@ -20607,6 +20642,7 @@ class PoThemeService {
20607
20642
  */
20608
20643
  createStyleElement(css, id) {
20609
20644
  const styleElement = this.renderer.createElement('style');
20645
+ applyCspNonce(styleElement, this.cspNonce, this.renderer);
20610
20646
  styleElement.id = id;
20611
20647
  this.renderer.appendChild(styleElement, this.renderer.createText(css));
20612
20648
  return styleElement;
@@ -20786,7 +20822,7 @@ class PoThemeService {
20786
20822
  // result: :root[class*="-dark-AA"]Add commentMore actions
20787
20823
  this.setPerComponentAndOnRoot({ type: PoThemeTypeEnum.dark, a11y: PoThemeA11yEnum.AA }, poThemeDefaultDarkValuesAA.perComponent, poThemeDefaultDarkValuesAA.onRoot);
20788
20824
  }
20789
- 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 });
20790
20826
  static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: PoThemeService, providedIn: 'root' });
20791
20827
  }
20792
20828
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: PoThemeService, decorators: [{
@@ -20802,6 +20838,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImpo
20802
20838
  }, {
20803
20839
  type: Inject,
20804
20840
  args: [ICONS_DICTIONARY]
20841
+ }] }, { type: undefined, decorators: [{
20842
+ type: Optional
20843
+ }, {
20844
+ type: Inject,
20845
+ args: [CSP_NONCE]
20805
20846
  }] }] });
20806
20847
 
20807
20848
  /**