From d7b4a946f8d3b078a96aeceb0764f9deb07310fc Mon Sep 17 00:00:00 2001 From: Vladimir Potekhin Date: Tue, 13 Aug 2024 14:37:36 +0300 Subject: [PATCH] chore(demo): fix icon resolver --- projects/demo/src/modules/app/app.providers.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/projects/demo/src/modules/app/app.providers.ts b/projects/demo/src/modules/app/app.providers.ts index 020bbb58c45ca..7c3ca81cd1b12 100644 --- a/projects/demo/src/modules/app/app.providers.ts +++ b/projects/demo/src/modules/app/app.providers.ts @@ -9,7 +9,7 @@ import {inject, PLATFORM_ID, Provider} from '@angular/core'; import {Title} from '@angular/platform-browser'; import {UrlTree} from '@angular/router'; import {environment} from '@demo/environments/environment'; -import {SESSION_STORAGE} from '@ng-web-apis/common'; +import {SESSION_STORAGE, WINDOW} from '@ng-web-apis/common'; import { TUI_DOC_CODE_EDITOR, TUI_DOC_DEFAULT_TABS, @@ -40,6 +40,7 @@ import { TUI_HINT_OPTIONS, TUI_SANITIZER, } from '@taiga-ui/core'; +import {TUI_ICON_RESOLVER} from '@taiga-ui/experimental'; import {TuiLanguageName, tuiLanguageSwitcher} from '@taiga-ui/i18n'; import {NgDompurifySanitizer} from '@tinkoff/ng-dompurify'; import {HIGHLIGHT_OPTIONS} from 'ngx-highlightjs'; @@ -206,6 +207,18 @@ export const APP_PROVIDERS: Provider[] = [ }, tuiDocExampleOptionsProvider({fullsize: false}), metrikaOptionsProvider({id: environment.ym}), + { + provide: TUI_ICON_RESOLVER, + deps: [WINDOW], + useFactory: (window: Window) => (icon: string) => + !icon || icon.includes('/') + ? icon + : `/assets/taiga-ui/icons/${ + window.origin.includes('taiga-ui') || icon.includes('Outline') + ? icon + : icon.replace('Large', '').concat('Outline') + }.svg`, + }, tuiLanguageSwitcher( async (language: TuiLanguageName): Promise => import(