diff --git a/projects/addon-doc/components/code/index.html b/projects/addon-doc/components/code/index.html index cdb8830869ebf..404153b91b5a9 100644 --- a/projects/addon-doc/components/code/index.html +++ b/projects/addon-doc/components/code/index.html @@ -5,7 +5,7 @@ {{ filename }}

     
diff --git a/projects/addon-doc/components/code/index.ts b/projects/addon-doc/components/code/index.ts
index 2adaf77580443..bf7b958a745f4 100644
--- a/projects/addon-doc/components/code/index.ts
+++ b/projects/addon-doc/components/code/index.ts
@@ -1,5 +1,5 @@
 import {ClipboardModule} from '@angular/cdk/clipboard';
-import {AsyncPipe, isPlatformServer, NgForOf, NgIf} from '@angular/common';
+import {isPlatformServer, NgForOf, NgIf} from '@angular/common';
 import {
     ChangeDetectionStrategy,
     Component,
@@ -14,7 +14,6 @@ import {
 } from '@taiga-ui/addon-doc/tokens';
 import type {TuiRawLoaderContent} from '@taiga-ui/addon-doc/types';
 import {tuiRawLoad} from '@taiga-ui/addon-doc/utils';
-import type {TuiHandler} from '@taiga-ui/cdk/types';
 import {TuiButton} from '@taiga-ui/core/components/button';
 import {Highlight} from 'ngx-highlightjs';
 import {BehaviorSubject, map, startWith, Subject, switchMap, timer} from 'rxjs';
@@ -22,7 +21,7 @@ import {BehaviorSubject, map, startWith, Subject, switchMap, timer} from 'rxjs';
 @Component({
     standalone: true,
     selector: 'tui-doc-code',
-    imports: [AsyncPipe, ClipboardModule, Highlight, NgForOf, NgIf, TuiButton],
+    imports: [ClipboardModule, Highlight, NgForOf, NgIf, TuiButton],
     templateUrl: './index.html',
     styleUrls: ['./index.less'],
     changeDetection: ChangeDetectionStrategy.OnPush,
@@ -37,7 +36,7 @@ export class TuiDocCode {
 
     protected readonly isServer = isPlatformServer(inject(PLATFORM_ID));
 
-    protected readonly markdownCodeProcessor = inject>(
+    protected readonly markdownCodeProcessor = inject(
         TUI_DOC_EXAMPLE_MARKDOWN_CODE_PROCESSOR,
     );
 
@@ -55,9 +54,12 @@ export class TuiDocCode {
         {initialValue: this.icons.copy},
     );
 
-    protected readonly processor$ = this.rawLoader$$.pipe(
-        switchMap(tuiRawLoad),
-        map((value: string): string[] => this.markdownCodeProcessor(value)),
+    protected readonly processor = toSignal(
+        this.rawLoader$$.pipe(
+            switchMap(tuiRawLoad),
+            map((value: string) => this.markdownCodeProcessor(value)),
+        ),
+        {initialValue: []},
     );
 
     @Input()
diff --git a/projects/addon-doc/components/copy/index.html b/projects/addon-doc/components/copy/index.html
index d8d373f4865a9..51d628221bf74 100644
--- a/projects/addon-doc/components/copy/index.html
+++ b/projects/addon-doc/components/copy/index.html
@@ -1,5 +1,4 @@
 
diff --git a/projects/addon-doc/components/copy/index.ts b/projects/addon-doc/components/copy/index.ts
index 8dce167007a87..a87463d93e66e 100644
--- a/projects/addon-doc/components/copy/index.ts
+++ b/projects/addon-doc/components/copy/index.ts
@@ -1,11 +1,9 @@
-import {AsyncPipe, NgIf} from '@angular/common';
+import {NgIf} from '@angular/common';
 import {ChangeDetectionStrategy, Component, inject} from '@angular/core';
+import {toSignal} from '@angular/core/rxjs-interop';
 import {TUI_FALSE_HANDLER} from '@taiga-ui/cdk/constants';
-import {TuiLet} from '@taiga-ui/cdk/directives/let';
-import {tuiPure} from '@taiga-ui/cdk/utils/miscellaneous';
 import {TuiButton} from '@taiga-ui/core/components/button';
 import {TUI_COPY_TEXTS} from '@taiga-ui/kit/tokens';
-import type {Observable} from 'rxjs';
 import {map, startWith, Subject, switchMap, timer} from 'rxjs';
 
 const COPIED_TIMEOUT = 1500;
@@ -13,7 +11,7 @@ const COPIED_TIMEOUT = 1500;
 @Component({
     standalone: true,
     selector: 'tui-doc-copy',
-    imports: [AsyncPipe, NgIf, TuiButton, TuiLet],
+    imports: [NgIf, TuiButton],
     templateUrl: './index.html',
     styleUrls: ['./index.less'],
     changeDetection: ChangeDetectionStrategy.OnPush,
@@ -21,16 +19,16 @@ const COPIED_TIMEOUT = 1500;
 export class TuiDocCopy {
     private readonly copy$ = new Subject();
 
-    protected readonly texts$ = inject(TUI_COPY_TEXTS);
+    protected readonly texts = toSignal(inject(TUI_COPY_TEXTS));
 
-    @tuiPure
-    protected get copied$(): Observable {
-        return this.copy$.pipe(
+    protected readonly copied = toSignal(
+        this.copy$.pipe(
             switchMap(() =>
                 timer(COPIED_TIMEOUT).pipe(map(TUI_FALSE_HANDLER), startWith(true)),
             ),
-        );
-    }
+        ),
+        {initialValue: true},
+    );
 
     protected onClick(): void {
         this.copy$.next();
diff --git a/projects/addon-doc/components/documentation/documentation-property-connector.directive.ts b/projects/addon-doc/components/documentation/documentation-property-connector.directive.ts
index b530bd20461fb..bd2521d354731 100644
--- a/projects/addon-doc/components/documentation/documentation-property-connector.directive.ts
+++ b/projects/addon-doc/components/documentation/documentation-property-connector.directive.ts
@@ -1,5 +1,5 @@
 import {Location} from '@angular/common';
-import type {OnChanges, OnInit} from '@angular/core';
+import {type OnChanges, type OnInit, signal} from '@angular/core';
 import {Directive, EventEmitter, inject, Input, Output, TemplateRef} from '@angular/core';
 import type {Params} from '@angular/router';
 import {ActivatedRoute, UrlSerializer} from '@angular/router';
@@ -7,7 +7,7 @@ import {TUI_DOC_URL_STATE_HANDLER} from '@taiga-ui/addon-doc/tokens';
 import {tuiCoerceValue, tuiInspectAny} from '@taiga-ui/addon-doc/utils';
 import {tuiIsNumber} from '@taiga-ui/cdk/utils/miscellaneous';
 import {TuiAlertService} from '@taiga-ui/core/components/alert';
-import {BehaviorSubject, Subject} from 'rxjs';
+import {Subject} from 'rxjs';
 
 const SERIALIZED_SUFFIX = '$';
 
@@ -49,7 +49,7 @@ export class TuiDocDocumentationPropertyConnector implements OnInit, OnChange
 
     public readonly changed$ = new Subject();
 
-    public readonly emits$ = new BehaviorSubject(1);
+    public readonly emits = signal(1);
 
     public readonly template = inject(TemplateRef);
 
@@ -92,7 +92,7 @@ export class TuiDocDocumentationPropertyConnector implements OnInit, OnChange
         // For more convenient debugging
         console.info(this.attrName, event);
 
-        this.emits$.next(this.emits$.value + 1);
+        this.emits.update((x) => ++x);
 
         let content: string | undefined;
 
diff --git a/projects/addon-doc/components/documentation/documentation.component.ts b/projects/addon-doc/components/documentation/documentation.component.ts
index d9f7e471c1b89..ec341109f33d2 100644
--- a/projects/addon-doc/components/documentation/documentation.component.ts
+++ b/projects/addon-doc/components/documentation/documentation.component.ts
@@ -1,12 +1,5 @@
 import {animate, style, transition, trigger} from '@angular/animations';
-import {
-    AsyncPipe,
-    NgForOf,
-    NgIf,
-    NgSwitch,
-    NgSwitchCase,
-    NgTemplateOutlet,
-} from '@angular/common';
+import {NgForOf, NgIf, NgSwitch, NgSwitchCase, NgTemplateOutlet} from '@angular/common';
 import type {AfterContentInit, QueryList} from '@angular/core';
 import {
     ChangeDetectionStrategy,
@@ -57,7 +50,6 @@ import {TuiDocTypeReferencePipe} from './pipes/type-reference.pipe';
     standalone: true,
     selector: 'tui-doc-documentation',
     imports: [
-        AsyncPipe,
         FormsModule,
         NgForOf,
         NgIf,
diff --git a/projects/addon-doc/components/documentation/documentation.template.html b/projects/addon-doc/components/documentation/documentation.template.html
index 4e5e47fa5a8de..2fe0c71070729 100644
--- a/projects/addon-doc/components/documentation/documentation.template.html
+++ b/projects/addon-doc/components/documentation/documentation.template.html
@@ -150,7 +150,7 @@
                 
                     
                         Emit!
                     
diff --git a/projects/addon-doc/components/example/example.component.ts b/projects/addon-doc/components/example/example.component.ts
index 4e1062a9cdd46..5d77599024614 100644
--- a/projects/addon-doc/components/example/example.component.ts
+++ b/projects/addon-doc/components/example/example.component.ts
@@ -1,6 +1,7 @@
 import {Clipboard} from '@angular/cdk/clipboard';
-import {AsyncPipe, NgForOf, NgIf, NgTemplateOutlet} from '@angular/common';
-import {ChangeDetectionStrategy, Component, inject, Input} from '@angular/core';
+import {NgForOf, NgIf, NgTemplateOutlet} from '@angular/common';
+import {ChangeDetectionStrategy, Component, inject, Input, signal} from '@angular/core';
+import {toSignal} from '@angular/core/rxjs-interop';
 import {RouterLink, RouterLinkActive} from '@angular/router';
 import {WA_LOCATION} from '@ng-web-apis/common';
 import {
@@ -27,8 +28,7 @@ import {
     PolymorpheusOutlet,
     PolymorpheusTemplate,
 } from '@taiga-ui/polymorpheus';
-import type {Observable} from 'rxjs';
-import {BehaviorSubject, map, ReplaySubject, Subject, switchAll, switchMap} from 'rxjs';
+import {BehaviorSubject, map, ReplaySubject, switchAll, switchMap} from 'rxjs';
 
 import {TuiDocCode} from '../code';
 import {TUI_DOC_EXAMPLE_OPTIONS} from './example.options';
@@ -38,7 +38,6 @@ import {TuiDocExampleGetTabsPipe} from './example-get-tabs.pipe';
     standalone: true,
     selector: 'tui-doc-example',
     imports: [
-        AsyncPipe,
         NgForOf,
         NgIf,
         NgTemplateOutlet,
@@ -90,18 +89,26 @@ export class TuiDocExample {
     protected readonly defaultTabIndex = 0;
     protected readonly defaultTab = this.texts[this.defaultTabIndex];
     protected activeItemIndex = this.defaultTabIndex;
-    protected readonly copy$ = this.copyTexts$.pipe(map(([copy]) => copy));
-    protected readonly loading$ = new Subject();
 
-    protected readonly processor$: Observable> =
+    protected readonly copy = toSignal(this.copyTexts$.pipe(map(([copy]) => copy)), {
+        initialValue: '',
+    });
+
+    protected readonly loading = signal(false);
+
+    protected readonly processor = toSignal(
         this.rawLoader$$.pipe(
             switchMap(tuiRawLoadRecord),
             map((value) => this.processContent(value)),
-        );
+        ),
+        {initialValue: {} as unknown as Record},
+    );
 
-    protected readonly lazyComponent$ = this.lazyLoader$$.pipe(
-        switchAll(),
-        map((module) => new PolymorpheusComponent(module.default)),
+    protected readonly lazyComponent = toSignal(
+        this.lazyLoader$$.pipe(
+            switchAll(),
+            map((module) => new PolymorpheusComponent(module.default)),
+        ),
     );
 
     @Input()
@@ -144,9 +151,9 @@ export class TuiDocExample {
     }
 
     protected edit(files: Record): void {
-        this.loading$.next(true);
+        this.loading.set(true);
         this.codeEditor
             ?.edit(this.componentName, this.id || '', files)
-            .finally(() => this.loading$.next(false));
+            .finally(() => this.loading.set(false));
     }
 }
diff --git a/projects/addon-doc/components/example/example.template.html b/projects/addon-doc/components/example/example.template.html
index 7240708627451..dae84fbcbbfb7 100644
--- a/projects/addon-doc/components/example/example.template.html
+++ b/projects/addon-doc/components/example/example.template.html
@@ -15,7 +15,7 @@
         tuiLink
         type="button"
         class="t-link"
-        [attr.title]="copy$ | async"
+        [attr.title]="copy()"
         [fragment]="id"
         [routerLinkActiveOptions]="{matrixParams: 'exact', queryParams: 'exact', paths: 'exact', fragment: 'exact'}"
         (click)="copyExampleLink($event.currentTarget)"
@@ -32,11 +32,8 @@
     
 
 
-
- +
+
@@ -96,13 +93,13 @@ [style.display]="activeItemIndex === index && index === defaultTabIndex ? 'block' : 'none'" > - + {{ text }}
diff --git a/projects/addon-doc/components/internal/header/index.html b/projects/addon-doc/components/internal/header/index.html index 183a87bf65b18..87d6ba54017dc 100644 --- a/projects/addon-doc/components/internal/header/index.html +++ b/projects/addon-doc/components/internal/header/index.html @@ -9,7 +9,7 @@ (tuiActiveZoneChange)="onActiveZone($event)" > diff --git a/projects/addon-doc/components/internal/header/index.ts b/projects/addon-doc/components/internal/header/index.ts index 886d0b1e1de61..ffc267d6676f3 100644 --- a/projects/addon-doc/components/internal/header/index.ts +++ b/projects/addon-doc/components/internal/header/index.ts @@ -1,5 +1,5 @@ -import {AsyncPipe} from '@angular/common'; import {ChangeDetectionStrategy, Component, inject} from '@angular/core'; +import {toSignal} from '@angular/core/rxjs-interop'; import {Router} from '@angular/router'; import {TUI_DOC_ICONS, TUI_DOC_LOGO, TUI_DOC_MENU_TEXT} from '@taiga-ui/addon-doc/tokens'; import {TuiSidebar} from '@taiga-ui/addon-mobile/directives/sidebar'; @@ -15,7 +15,6 @@ import {TuiDocNavigation} from '../../navigation/navigation.component'; standalone: true, selector: 'header[tuiDocHeader]', imports: [ - AsyncPipe, PolymorpheusOutlet, PolymorpheusTemplate, TuiActiveZone, @@ -33,10 +32,14 @@ export class TuiDocHeader { protected readonly icons = inject(TUI_DOC_ICONS); protected readonly logo = inject(TUI_DOC_LOGO); protected readonly menu = inject(TUI_DOC_MENU_TEXT); - protected readonly open$ = merge( - this.router.events.pipe(map(TUI_FALSE_HANDLER)), - this.stream$, - ).pipe(startWith(false), distinctUntilChanged()); + + protected readonly open = toSignal( + merge(this.router.events.pipe(map(TUI_FALSE_HANDLER)), this.stream$).pipe( + startWith(false), + distinctUntilChanged(), + ), + {initialValue: false}, + ); protected onClick(): void { this.stream$.next(true); diff --git a/projects/addon-doc/components/navigation/navigation.component.ts b/projects/addon-doc/components/navigation/navigation.component.ts index f6fb2818c9429..0c381444e277e 100644 --- a/projects/addon-doc/components/navigation/navigation.component.ts +++ b/projects/addon-doc/components/navigation/navigation.component.ts @@ -1,4 +1,4 @@ -import {AsyncPipe, DOCUMENT, NgForOf, NgIf, NgTemplateOutlet} from '@angular/common'; +import {DOCUMENT, NgForOf, NgIf, NgTemplateOutlet} from '@angular/common'; import { ChangeDetectionStrategy, ChangeDetectorRef, @@ -8,7 +8,7 @@ import { signal, ViewChild, } from '@angular/core'; -import {takeUntilDestroyed} from '@angular/core/rxjs-interop'; +import {takeUntilDestroyed, toSignal} from '@angular/core/rxjs-interop'; import {FormControl, ReactiveFormsModule} from '@angular/forms'; import {Title} from '@angular/platform-browser'; import {Router, RouterLink, RouterLinkActive, Scroll} from '@angular/router'; @@ -49,7 +49,6 @@ import {TuiDocScrollIntoViewLink} from './scroll-into-view.directive'; standalone: true, selector: 'tui-doc-navigation', imports: [ - AsyncPipe, NgForOf, NgIf, NgTemplateOutlet, @@ -103,9 +102,12 @@ export class TuiDocNavigation { protected readonly search = new FormControl(''); - protected readonly filtered$ = tuiControlValue(this.search).pipe( - filter((search) => search.trim().length > 2), - map((search) => this.filterItems(this.flattenSubPages(this.items), search)), + protected readonly filtered = toSignal( + tuiControlValue(this.search).pipe( + filter((search) => search.trim().length > 2), + map((search) => this.filterItems(this.flattenSubPages(this.items), search)), + ), + {initialValue: []}, ); constructor() { diff --git a/projects/addon-doc/components/navigation/navigation.template.html b/projects/addon-doc/components/navigation/navigation.template.html index 403052c11c321..e1af843eb72ed 100644 --- a/projects/addon-doc/components/navigation/navigation.template.html +++ b/projects/addon-doc/components/navigation/navigation.template.html @@ -23,7 +23,7 @@ diff --git a/projects/addon-doc/tokens/example-content-processor.ts b/projects/addon-doc/tokens/example-content-processor.ts index 1fe6afb166415..ed4d31823e41e 100644 --- a/projects/addon-doc/tokens/example-content-processor.ts +++ b/projects/addon-doc/tokens/example-content-processor.ts @@ -13,5 +13,5 @@ export const TUI_DOC_EXAMPLE_CONTENT_PROCESSOR = * Processes markdown in code block */ export const TUI_DOC_EXAMPLE_MARKDOWN_CODE_PROCESSOR = tuiCreateToken< - TuiHandler + TuiHandler >(tuiTryParseMarkdownCodeBlock);