From 9156cb0cc6e9f28663c53fc04e064a5a2fb6e355 Mon Sep 17 00:00:00 2001 From: Alexander Date: Sat, 21 Sep 2024 19:17:06 +0300 Subject: [PATCH] feat(kit): review fixes --- projects/kit/directives/highlight/highlight.directive.ts | 9 ++++++--- projects/kit/directives/highlight/highlight.options.ts | 5 ----- projects/kit/directives/highlight/index.ts | 1 - 3 files changed, 6 insertions(+), 9 deletions(-) delete mode 100644 projects/kit/directives/highlight/highlight.options.ts diff --git a/projects/kit/directives/highlight/highlight.directive.ts b/projects/kit/directives/highlight/highlight.directive.ts index 2799e6ff007a..b3d2d257cdfe 100644 --- a/projects/kit/directives/highlight/highlight.directive.ts +++ b/projects/kit/directives/highlight/highlight.directive.ts @@ -6,8 +6,11 @@ import {ResizeObserverService} from '@ng-web-apis/resize-observer'; import {svgNodeFilter} from '@taiga-ui/cdk/constants'; import {tuiInjectElement} from '@taiga-ui/cdk/utils/dom'; import {tuiPx} from '@taiga-ui/cdk/utils/miscellaneous'; +import {tuiCreateOptions} from '@taiga-ui/cdk/utils/di'; -import {TUI_HIGHLIGHT_OPTIONS} from './highlight.options'; +export const [TUI_HIGHLIGHT_OPTIONS, tuiHighlightOptionsProvider] = tuiCreateOptions({ + highlightColor: 'var(--tui-service-selection-background)', +}); @Directive({ standalone: true, @@ -22,7 +25,7 @@ export class TuiHighlight implements OnChanges { private readonly el = tuiInjectElement(); private readonly renderer = inject(Renderer2); private readonly doc = inject(DOCUMENT); - private readonly options = inject(TUI_HIGHLIGHT_OPTIONS); + private readonly highlight: HTMLElement = this.setUpHighlight(); private readonly treeWalker = this.doc.createTreeWalker( this.el, @@ -34,7 +37,7 @@ export class TuiHighlight implements OnChanges { public tuiHighlight = ''; @Input() - public tuiHighlightColor = this.options.highlightColor; + public tuiHighlightColor = inject(TUI_HIGHLIGHT_OPTIONS).highlightColor; constructor() { inject(ResizeObserverService, {self: true}) diff --git a/projects/kit/directives/highlight/highlight.options.ts b/projects/kit/directives/highlight/highlight.options.ts deleted file mode 100644 index d2367adbfb7e..000000000000 --- a/projects/kit/directives/highlight/highlight.options.ts +++ /dev/null @@ -1,5 +0,0 @@ -import {tuiCreateOptions} from '@taiga-ui/cdk/utils/di'; - -export const [TUI_HIGHLIGHT_OPTIONS, tuiHighlightOptionsProvider] = tuiCreateOptions({ - highlightColor: 'var(--tui-service-selection-background)', -} as const); diff --git a/projects/kit/directives/highlight/index.ts b/projects/kit/directives/highlight/index.ts index efd34d119b2b..105a03568084 100644 --- a/projects/kit/directives/highlight/index.ts +++ b/projects/kit/directives/highlight/index.ts @@ -1,2 +1 @@ export * from './highlight.directive'; -export * from './highlight.options';