Skip to content

Commit

Permalink
chore(deps): update taiga-ui (#229)
Browse files Browse the repository at this point in the history
* chore(deps): update taiga-ui

* chore(deps): update taiga-ui

---------

Co-authored-by: splincode <[email protected]>
  • Loading branch information
taiga-family-bot and splincode authored Feb 27, 2024
1 parent 1f6415d commit 964d4d0
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 48 deletions.
4 changes: 2 additions & 2 deletions jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ const config: Config = {
coverageReporters: ['html', 'lcov', 'json', 'text', 'lcov'],
moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths, {
prefix: `<rootDir>/${compilerOptions.baseUrl}/`
.replace(/\.\//g, '/')
.replace(/\/\/+/g, '/'),
.replaceAll('./', '/')
.replaceAll(/\/\/+/g, '/'),
}),
verbose: true,
};
Expand Down
42 changes: 21 additions & 21 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,10 @@
"@nguniversal/express-engine": "15.2.1",
"@taiga-ui/browserslist-config": "0.5.0",
"@taiga-ui/commitlint-config": "0.5.6",
"@taiga-ui/eslint-plugin-experience": "0.54.1",
"@taiga-ui/prettier-config": "0.8.3",
"@taiga-ui/eslint-plugin-experience": "0.58.0",
"@taiga-ui/prettier-config": "0.8.4",
"@taiga-ui/stylelint-config": "0.16.0",
"@taiga-ui/tsconfig": "0.15.0",
"@taiga-ui/tsconfig": "0.16.0",
"@types/dompurify": "3.0.5",
"@types/eslint": "8.56.3",
"@types/express": "4.17.21",
Expand Down
6 changes: 3 additions & 3 deletions projects/demo/src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {ChangeDetectionStrategy, Component, Inject, SecurityContext} from '@angular/core';
import {ChangeDetectionStrategy, Component, inject, SecurityContext} from '@angular/core';
import {DomSanitizer, SafeValue} from '@angular/platform-browser';

const dirtyHtml =
Expand All @@ -13,11 +13,11 @@ const svg = `<svg width="56" height="56">
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class AppComponent {
private readonly sanitizer = inject(DomSanitizer);

value = dirtyHtml;
domValue = svg;

constructor(@Inject(DomSanitizer) private readonly sanitizer: DomSanitizer) {}

unwrap(value: SafeValue | null): string {
return this.sanitizer.sanitize(SecurityContext.HTML, value) || '';
}
Expand Down
8 changes: 3 additions & 5 deletions projects/ng-dompurify/lib/ng-dompurify.pipe.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Inject, Pipe, PipeTransform, SecurityContext} from '@angular/core';
import {inject, Pipe, PipeTransform, SecurityContext} from '@angular/core';
import {DomSanitizer, SafeValue} from '@angular/platform-browser';

import {NgDompurifySanitizer} from './ng-dompurify.service';
Expand All @@ -12,10 +12,8 @@ import {NgDompurifyConfig} from './types/ng-dompurify-config';
name: 'dompurify',
})
export class NgDompurifyPipe implements PipeTransform {
constructor(
@Inject(NgDompurifySanitizer) private readonly sanitizer: NgDompurifySanitizer,
@Inject(DomSanitizer) private readonly domSanitizer: DomSanitizer,
) {}
private readonly sanitizer = inject(NgDompurifySanitizer);
private readonly domSanitizer = inject(DomSanitizer);

transform(
value: Record<string, string> | string | null,
Expand Down
20 changes: 6 additions & 14 deletions projects/ng-dompurify/lib/ng-dompurify.service.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import {DOCUMENT} from '@angular/common';
import {Inject, Injectable, Sanitizer, SecurityContext} from '@angular/core';
import {inject, Injectable, Sanitizer, SecurityContext} from '@angular/core';
import dompurify, {DOMPurifyI} from 'dompurify';

import {DOMPURIFY_CONFIG} from './tokens/dompurify-config';
import {DOMPURIFY_HOOKS} from './tokens/dompurify-hooks';
import {SANITIZE_STYLE} from './tokens/sanitize-style';
import {NgDompurifyConfig} from './types/ng-dompurify-config';
import {NgDompurifyHook} from './types/ng-dompurify-hook';
import {SanitizeStyle} from './types/sanitize-style';

const createDOMPurify = dompurify;

Expand All @@ -25,20 +23,14 @@ const createDOMPurify = dompurify;
providedIn: 'root',
})
export class NgDompurifySanitizer implements Sanitizer {
private readonly config = inject(DOMPURIFY_CONFIG);
private readonly sanitizeStyle = inject(SANITIZE_STYLE);
private readonly domPurify: DOMPurifyI;

constructor(
@Inject(DOMPURIFY_CONFIG)
private readonly config: NgDompurifyConfig,
@Inject(SANITIZE_STYLE)
private readonly sanitizeStyle: SanitizeStyle,
@Inject(DOCUMENT) {defaultView}: Document,
@Inject(DOMPURIFY_HOOKS)
hooks: readonly NgDompurifyHook[],
) {
this.domPurify = createDOMPurify(defaultView as Window);
constructor() {
this.domPurify = createDOMPurify(inject(DOCUMENT).defaultView as Window);

hooks.forEach(({name, hook}) => {
inject(DOMPURIFY_HOOKS).forEach(({name, hook}) => {
this.domPurify.addHook(name, hook);
});
}
Expand Down

0 comments on commit 964d4d0

Please sign in to comment.