Skip to content

Commit

Permalink
refactor(docs-infra): migrate adev directives to output
Browse files Browse the repository at this point in the history
This commit is the result of running automated migration
that convert decorator-based @output to its function
equivalent.
  • Loading branch information
pkozlowski-opensource committed Oct 29, 2024
1 parent 35d7ca5 commit d6c0661
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,7 @@
* found in the LICENSE file at https://angular.dev/license
*/

import {
ChangeDetectionStrategy,
Component,
EventEmitter,
Input,
Output,
inject,
} from '@angular/core';
import {ChangeDetectionStrategy, Component, Input, inject, output} from '@angular/core';
import {NavigationItem} from '../../interfaces/index';
import {NavigationState} from '../../services/index';
import {RouterLink, RouterLinkActive} from '@angular/router';
Expand All @@ -36,7 +29,7 @@ export class NavigationList {
@Input() expandableLevel: number = 2;
@Input() isDropdownView = false;

@Output() linkClicked = new EventEmitter<void>();
readonly linkClicked = output<void>();

private readonly navigationState = inject(NavigationState);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ import {
ViewContainerRef,
ViewEncapsulation,
ɵPendingTasks as PendingTasks,
EventEmitter,
Output,
output,
} from '@angular/core';
import {takeUntilDestroyed} from '@angular/core/rxjs-interop';
import {TOC_SKIP_CONTENT_MARKER, NavigationState} from '../../../services/index';
Expand Down Expand Up @@ -68,7 +67,7 @@ export const GITHUB_CONTENT_URL =
export class DocViewer implements OnChanges {
@Input() docContent?: string;
@Input() hasToc = false;
@Output() contentLoaded = new EventEmitter<void>();
readonly contentLoaded = output<void>();

private readonly destroyRef = inject(DestroyRef);
private readonly document = inject(DOCUMENT);
Expand Down Expand Up @@ -134,7 +133,7 @@ export class DocViewer implements OnChanges {
// Render ToC
this.renderTableOfContents(contentContainer);

this.contentLoaded.next();
this.contentLoaded.emit();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

import {DOCUMENT} from '@angular/common';
import {Directive, ElementRef, EventEmitter, Input, Output, inject} from '@angular/core';
import {Directive, ElementRef, Input, inject, output} from '@angular/core';

@Directive({
selector: '[docsClickOutside]',
Expand All @@ -18,7 +18,7 @@ import {Directive, ElementRef, EventEmitter, Input, Output, inject} from '@angul
})
export class ClickOutside {
@Input('docsClickOutsideIgnore') public ignoredElementsIds: string[] = [];
@Output('docsClickOutside') public clickOutside = new EventEmitter<void>();
public readonly clickOutside = output<void>('docsClickOutside');

private readonly document = inject(DOCUMENT);
private readonly elementRef = inject(ElementRef<HTMLElement>);
Expand Down

0 comments on commit d6c0661

Please sign in to comment.