1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-10 21:33:27 +00:00

Tools - Prefer signal & change detection (#16941)

This commit is contained in:
Oscar Hinton
2025-10-21 15:49:22 +02:00
committed by GitHub
parent 6abaaa7b13
commit f23f3f87bd
66 changed files with 329 additions and 11 deletions

View File

@@ -19,6 +19,8 @@ import {
} from "@bitwarden/generator-core";
/** Options group for catchall emails */
// FIXME(https://bitwarden.atlassian.net/browse/CL-764): Migrate to OnPush
// eslint-disable-next-line @angular-eslint/prefer-on-push-component-change-detection
@Component({
selector: "tools-catchall-settings",
templateUrl: "catchall-settings.component.html",
@@ -38,6 +40,8 @@ export class CatchallSettingsComponent implements OnInit, OnDestroy, OnChanges {
* @remarks this is initialized to null but since it's a required input it'll
* never have that value in practice.
*/
// FIXME(https://bitwarden.atlassian.net/browse/CL-903): Migrate to Signals
// eslint-disable-next-line @angular-eslint/prefer-signals
@Input({ required: true })
account!: Account;
@@ -48,6 +52,8 @@ export class CatchallSettingsComponent implements OnInit, OnDestroy, OnChanges {
* to receive live settings updates including the initial update,
* use `CredentialGeneratorService.settings(...)` instead.
*/
// FIXME(https://bitwarden.atlassian.net/browse/CL-903): Migrate to Signals
// eslint-disable-next-line @angular-eslint/prefer-output-emitter-ref
@Output()
readonly onUpdated = new EventEmitter<CatchallGenerationOptions>();

View File

@@ -27,6 +27,8 @@ import { GeneratorHistoryService } from "@bitwarden/generator-history";
import { CredentialGeneratorHistoryComponent as CredentialGeneratorHistoryToolsComponent } from "./credential-generator-history.component";
import { EmptyCredentialHistoryComponent } from "./empty-credential-history.component";
// FIXME(https://bitwarden.atlassian.net/browse/CL-764): Migrate to OnPush
// eslint-disable-next-line @angular-eslint/prefer-on-push-component-change-detection
@Component({
templateUrl: "credential-generator-history-dialog.component.html",
imports: [
@@ -49,6 +51,8 @@ export class CredentialGeneratorHistoryDialogComponent implements OnChanges, OnI
private logService: LogService,
) {}
// FIXME(https://bitwarden.atlassian.net/browse/CL-903): Migrate to Signals
// eslint-disable-next-line @angular-eslint/prefer-signals
@Input()
account: Account | null;
@@ -59,6 +63,8 @@ export class CredentialGeneratorHistoryDialogComponent implements OnChanges, OnI
*
* @warning this may reveal sensitive information in plaintext.
*/
// FIXME(https://bitwarden.atlassian.net/browse/CL-903): Migrate to Signals
// eslint-disable-next-line @angular-eslint/prefer-signals
@Input()
debug: boolean = false;

View File

@@ -26,6 +26,8 @@ import { GeneratedCredential, GeneratorHistoryService } from "@bitwarden/generat
import { GeneratorModule } from "./generator.module";
import { translate } from "./util";
// FIXME(https://bitwarden.atlassian.net/browse/CL-764): Migrate to OnPush
// eslint-disable-next-line @angular-eslint/prefer-on-push-component-change-detection
@Component({
selector: "bit-credential-generator-history",
templateUrl: "credential-generator-history.component.html",
@@ -50,6 +52,8 @@ export class CredentialGeneratorHistoryComponent implements OnChanges, OnInit, O
private logService: LogService,
) {}
// FIXME(https://bitwarden.atlassian.net/browse/CL-903): Migrate to Signals
// eslint-disable-next-line @angular-eslint/prefer-signals
@Input({ required: true })
account: Account;
@@ -60,6 +64,8 @@ export class CredentialGeneratorHistoryComponent implements OnChanges, OnInit, O
*
* @warning this may reveal sensitive information in plaintext.
*/
// FIXME(https://bitwarden.atlassian.net/browse/CL-903): Migrate to Signals
// eslint-disable-next-line @angular-eslint/prefer-signals
@Input()
debug: boolean = false;

View File

@@ -64,6 +64,8 @@ const IDENTIFIER = "identifier";
const FORWARDER = "forwarder";
const NONE_SELECTED = "none";
// FIXME(https://bitwarden.atlassian.net/browse/CL-764): Migrate to OnPush
// eslint-disable-next-line @angular-eslint/prefer-on-push-component-change-detection
@Component({
selector: "tools-credential-generator",
templateUrl: "credential-generator.component.html",
@@ -90,6 +92,8 @@ export class CredentialGeneratorComponent implements OnInit, OnChanges, OnDestro
/** Binds the component to a specific user's settings. When this input is not provided,
* the form binds to the active user
*/
// FIXME(https://bitwarden.atlassian.net/browse/CL-903): Migrate to Signals
// eslint-disable-next-line @angular-eslint/prefer-signals
@Input()
account: Account | null = null;
@@ -98,6 +102,8 @@ export class CredentialGeneratorComponent implements OnInit, OnChanges, OnDestro
*
* @warning this may reveal sensitive information in plaintext.
*/
// FIXME(https://bitwarden.atlassian.net/browse/CL-903): Migrate to Signals
// eslint-disable-next-line @angular-eslint/prefer-signals
@Input()
debug: boolean = false;
@@ -123,10 +129,14 @@ export class CredentialGeneratorComponent implements OnInit, OnChanges, OnDestro
/**
* The website associated with the credential generation request.
*/
// FIXME(https://bitwarden.atlassian.net/browse/CL-903): Migrate to Signals
// eslint-disable-next-line @angular-eslint/prefer-signals
@Input()
website: string | null = null;
/** Emits credentials created from a generation request. */
// FIXME(https://bitwarden.atlassian.net/browse/CL-903): Migrate to Signals
// eslint-disable-next-line @angular-eslint/prefer-output-emitter-ref
@Output()
readonly onGenerated = new EventEmitter<GeneratedCredential>();

View File

@@ -4,6 +4,8 @@ import { JslibModule } from "@bitwarden/angular/jslib.module";
import { NoCredentialsIcon } from "@bitwarden/assets/svg";
import { NoItemsModule } from "@bitwarden/components";
// FIXME(https://bitwarden.atlassian.net/browse/CL-764): Migrate to OnPush
// eslint-disable-next-line @angular-eslint/prefer-on-push-component-change-detection
@Component({
selector: "bit-empty-credential-history",
templateUrl: "empty-credential-history.component.html",

View File

@@ -26,6 +26,8 @@ const Controls = Object.freeze({
});
/** Options group for forwarder integrations */
// FIXME(https://bitwarden.atlassian.net/browse/CL-764): Migrate to OnPush
// eslint-disable-next-line @angular-eslint/prefer-on-push-component-change-detection
@Component({
selector: "tools-forwarder-settings",
templateUrl: "forwarder-settings.component.html",
@@ -45,11 +47,15 @@ export class ForwarderSettingsComponent implements OnInit, OnChanges, OnDestroy
* @remarks this is initialized to null but since it's a required input it'll
* never have that value in practice.
*/
// FIXME(https://bitwarden.atlassian.net/browse/CL-903): Migrate to Signals
// eslint-disable-next-line @angular-eslint/prefer-signals
@Input({ required: true })
account: Account = null!;
protected account$ = new ReplaySubject<Account>(1);
// FIXME(https://bitwarden.atlassian.net/browse/CL-903): Migrate to Signals
// eslint-disable-next-line @angular-eslint/prefer-signals
@Input({ required: true })
forwarder: VendorId = null!;
@@ -58,6 +64,8 @@ export class ForwarderSettingsComponent implements OnInit, OnChanges, OnDestroy
* to receive live settings updates including the initial update,
* use `CredentialGeneratorService.settings$(...)` instead.
*/
// FIXME(https://bitwarden.atlassian.net/browse/CL-903): Migrate to Signals
// eslint-disable-next-line @angular-eslint/prefer-output-emitter-ref
@Output()
readonly onUpdated = new EventEmitter<unknown>();

View File

@@ -10,6 +10,8 @@ import { UserId } from "@bitwarden/common/types/guid";
import { TypographyModule } from "@bitwarden/components";
import { I18nPipe } from "@bitwarden/ui-common";
// FIXME(https://bitwarden.atlassian.net/browse/CL-764): Migrate to OnPush
// eslint-disable-next-line @angular-eslint/prefer-on-push-component-change-detection
@Component({
selector: "nudge-generator-spotlight",
templateUrl: "nudge-generator-spotlight.component.html",

View File

@@ -34,6 +34,8 @@ const Controls = Object.freeze({
});
/** Options group for passphrases */
// FIXME(https://bitwarden.atlassian.net/browse/CL-764): Migrate to OnPush
// eslint-disable-next-line @angular-eslint/prefer-on-push-component-change-detection
@Component({
selector: "tools-passphrase-settings",
templateUrl: "passphrase-settings.component.html",
@@ -57,6 +59,8 @@ export class PassphraseSettingsComponent implements OnInit, OnChanges, OnDestroy
*
* @warning this may reveal sensitive information in plaintext.
*/
// FIXME(https://bitwarden.atlassian.net/browse/CL-903): Migrate to Signals
// eslint-disable-next-line @angular-eslint/prefer-signals
@Input()
debug: boolean = false;
@@ -67,6 +71,8 @@ export class PassphraseSettingsComponent implements OnInit, OnChanges, OnDestroy
* @remarks this is initialized to null but since it's a required input it'll
* never have that value in practice.
*/
// FIXME(https://bitwarden.atlassian.net/browse/CL-903): Migrate to Signals
// eslint-disable-next-line @angular-eslint/prefer-signals
@Input({ required: true })
account: Account = null!;
@@ -79,10 +85,14 @@ export class PassphraseSettingsComponent implements OnInit, OnChanges, OnDestroy
}
/** When `true`, an options header is displayed by the component. Otherwise, the header is hidden. */
// FIXME(https://bitwarden.atlassian.net/browse/CL-903): Migrate to Signals
// eslint-disable-next-line @angular-eslint/prefer-signals
@Input()
showHeader: boolean = true;
/** Removes bottom margin from `bit-section` */
// FIXME(https://bitwarden.atlassian.net/browse/CL-903): Migrate to Signals
// eslint-disable-next-line @angular-eslint/prefer-signals
@Input({ transform: coerceBooleanProperty }) disableMargin = false;
/** Emits settings updates and completes if the settings become unavailable.
@@ -90,6 +100,8 @@ export class PassphraseSettingsComponent implements OnInit, OnChanges, OnDestroy
* to receive live settings updates including the initial update,
* use {@link CredentialGeneratorService.settings} instead.
*/
// FIXME(https://bitwarden.atlassian.net/browse/CL-903): Migrate to Signals
// eslint-disable-next-line @angular-eslint/prefer-output-emitter-ref
@Output()
readonly onUpdated = new EventEmitter<PassphraseGenerationOptions>();

View File

@@ -53,6 +53,8 @@ import { GeneratorHistoryService } from "@bitwarden/generator-history";
import { toAlgorithmInfo, translate } from "./util";
/** Options group for passwords */
// FIXME(https://bitwarden.atlassian.net/browse/CL-764): Migrate to OnPush
// eslint-disable-next-line @angular-eslint/prefer-on-push-component-change-detection
@Component({
selector: "tools-password-generator",
templateUrl: "password-generator.component.html",
@@ -76,6 +78,8 @@ export class PasswordGeneratorComponent implements OnInit, OnChanges, OnDestroy
/** Binds the component to a specific user's settings. When this input is not provided,
* the form binds to the active user
*/
// FIXME(https://bitwarden.atlassian.net/browse/CL-903): Migrate to Signals
// eslint-disable-next-line @angular-eslint/prefer-signals
@Input()
account: Account | null = null;
@@ -86,6 +90,8 @@ export class PasswordGeneratorComponent implements OnInit, OnChanges, OnDestroy
*
* @warning this may reveal sensitive information in plaintext.
*/
// FIXME(https://bitwarden.atlassian.net/browse/CL-903): Migrate to Signals
// eslint-disable-next-line @angular-eslint/prefer-signals
@Input()
debug: boolean = false;
@@ -110,10 +116,14 @@ export class PasswordGeneratorComponent implements OnInit, OnChanges, OnDestroy
}
}
// FIXME(https://bitwarden.atlassian.net/browse/CL-903): Migrate to Signals
// eslint-disable-next-line @angular-eslint/prefer-signals
@Input()
profile: GeneratorProfile = Profile.account;
/** Removes bottom margin, passed to downstream components */
// FIXME(https://bitwarden.atlassian.net/browse/CL-903): Migrate to Signals
// eslint-disable-next-line @angular-eslint/prefer-signals
@Input({ transform: coerceBooleanProperty })
disableMargin = false;
@@ -154,10 +164,14 @@ export class PasswordGeneratorComponent implements OnInit, OnChanges, OnDestroy
}
/** Emits credentials created from a generation request. */
// FIXME(https://bitwarden.atlassian.net/browse/CL-903): Migrate to Signals
// eslint-disable-next-line @angular-eslint/prefer-output-emitter-ref
@Output()
readonly onGenerated = new EventEmitter<GeneratedCredential>();
/** emits algorithm info when the selected algorithm changes */
// FIXME(https://bitwarden.atlassian.net/browse/CL-903): Migrate to Signals
// eslint-disable-next-line @angular-eslint/prefer-output-emitter-ref
@Output()
readonly onAlgorithm = new EventEmitter<AlgorithmInfo>();

View File

@@ -34,6 +34,8 @@ const Controls = Object.freeze({
});
/** Options group for passwords */
// FIXME(https://bitwarden.atlassian.net/browse/CL-764): Migrate to OnPush
// eslint-disable-next-line @angular-eslint/prefer-on-push-component-change-detection
@Component({
selector: "tools-password-settings",
templateUrl: "password-settings.component.html",
@@ -55,6 +57,8 @@ export class PasswordSettingsComponent implements OnInit, OnChanges, OnDestroy {
* @remarks this is initialized to null but since it's a required input it'll
* never have that value in practice.
*/
// FIXME(https://bitwarden.atlassian.net/browse/CL-903): Migrate to Signals
// eslint-disable-next-line @angular-eslint/prefer-signals
@Input({ required: true })
account: Account = null!;
@@ -67,14 +71,20 @@ export class PasswordSettingsComponent implements OnInit, OnChanges, OnDestroy {
}
/** When `true`, an options header is displayed by the component. Otherwise, the header is hidden. */
// FIXME(https://bitwarden.atlassian.net/browse/CL-903): Migrate to Signals
// eslint-disable-next-line @angular-eslint/prefer-signals
@Input()
showHeader: boolean = true;
/** Number of milliseconds to wait before accepting user input. */
// FIXME(https://bitwarden.atlassian.net/browse/CL-903): Migrate to Signals
// eslint-disable-next-line @angular-eslint/prefer-signals
@Input()
waitMs: number = 100;
/** Removes bottom margin from `bit-section` */
// FIXME(https://bitwarden.atlassian.net/browse/CL-903): Migrate to Signals
// eslint-disable-next-line @angular-eslint/prefer-signals
@Input({ transform: coerceBooleanProperty }) disableMargin = false;
/** Emits settings updates and completes if the settings become unavailable.
@@ -82,6 +92,8 @@ export class PasswordSettingsComponent implements OnInit, OnChanges, OnDestroy {
* to receive live settings updates including the initial update,
* use `CredentialGeneratorService.settings(...)` instead.
*/
// FIXME(https://bitwarden.atlassian.net/browse/CL-903): Migrate to Signals
// eslint-disable-next-line @angular-eslint/prefer-output-emitter-ref
@Output()
readonly onUpdated = new EventEmitter<PasswordGenerationOptions>();

View File

@@ -19,6 +19,8 @@ import {
} from "@bitwarden/generator-core";
/** Options group for plus-addressed emails */
// FIXME(https://bitwarden.atlassian.net/browse/CL-764): Migrate to OnPush
// eslint-disable-next-line @angular-eslint/prefer-on-push-component-change-detection
@Component({
selector: "tools-subaddress-settings",
templateUrl: "subaddress-settings.component.html",
@@ -38,6 +40,8 @@ export class SubaddressSettingsComponent implements OnInit, OnChanges, OnDestroy
* @remarks this is initialized to null but since it's a required input it'll
* never have that value in practice.
*/
// FIXME(https://bitwarden.atlassian.net/browse/CL-903): Migrate to Signals
// eslint-disable-next-line @angular-eslint/prefer-signals
@Input({ required: true })
account: Account = null!;
@@ -54,6 +58,8 @@ export class SubaddressSettingsComponent implements OnInit, OnChanges, OnDestroy
* to receive live settings updates including the initial update,
* use `CredentialGeneratorService.settings(...)` instead.
*/
// FIXME(https://bitwarden.atlassian.net/browse/CL-903): Migrate to Signals
// eslint-disable-next-line @angular-eslint/prefer-output-emitter-ref
@Output()
readonly onUpdated = new EventEmitter<SubaddressGenerationOptions>();

View File

@@ -64,6 +64,8 @@ const FORWARDER = "forwarder";
const NONE_SELECTED = "none";
/** Component that generates usernames and emails */
// FIXME(https://bitwarden.atlassian.net/browse/CL-764): Migrate to OnPush
// eslint-disable-next-line @angular-eslint/prefer-on-push-component-change-detection
@Component({
selector: "tools-username-generator",
templateUrl: "username-generator.component.html",
@@ -95,6 +97,8 @@ export class UsernameGeneratorComponent implements OnInit, OnChanges, OnDestroy
/** Binds the component to a specific user's settings. When this input is not provided,
* the form binds to the active user
*/
// FIXME(https://bitwarden.atlassian.net/browse/CL-903): Migrate to Signals
// eslint-disable-next-line @angular-eslint/prefer-signals
@Input()
account: Account | null = null;
@@ -105,6 +109,8 @@ export class UsernameGeneratorComponent implements OnInit, OnChanges, OnDestroy
*
* @warning this may reveal sensitive information in plaintext.
*/
// FIXME(https://bitwarden.atlassian.net/browse/CL-903): Migrate to Signals
// eslint-disable-next-line @angular-eslint/prefer-signals
@Input()
debug: boolean = false;
@@ -132,18 +138,26 @@ export class UsernameGeneratorComponent implements OnInit, OnChanges, OnDestroy
/**
* The website associated with the credential generation request.
*/
// FIXME(https://bitwarden.atlassian.net/browse/CL-903): Migrate to Signals
// eslint-disable-next-line @angular-eslint/prefer-signals
@Input()
website: string | null = null;
/** Emits credentials created from a generation request. */
// FIXME(https://bitwarden.atlassian.net/browse/CL-903): Migrate to Signals
// eslint-disable-next-line @angular-eslint/prefer-output-emitter-ref
@Output()
readonly onGenerated = new EventEmitter<GeneratedCredential>();
/** emits algorithm info when the selected algorithm changes */
// FIXME(https://bitwarden.atlassian.net/browse/CL-903): Migrate to Signals
// eslint-disable-next-line @angular-eslint/prefer-output-emitter-ref
@Output()
readonly onAlgorithm = new EventEmitter<AlgorithmInfo | null>();
/** Removes bottom margin from internal elements */
// FIXME(https://bitwarden.atlassian.net/browse/CL-903): Migrate to Signals
// eslint-disable-next-line @angular-eslint/prefer-signals
@Input({ transform: coerceBooleanProperty }) disableMargin = false;
/** Tracks the selected generation algorithm */

View File

@@ -19,6 +19,8 @@ import {
} from "@bitwarden/generator-core";
/** Options group for usernames */
// FIXME(https://bitwarden.atlassian.net/browse/CL-764): Migrate to OnPush
// eslint-disable-next-line @angular-eslint/prefer-on-push-component-change-detection
@Component({
selector: "tools-username-settings",
templateUrl: "username-settings.component.html",
@@ -38,6 +40,8 @@ export class UsernameSettingsComponent implements OnInit, OnChanges, OnDestroy {
* @remarks this is initialized to null but since it's a required input it'll
* never have that value in practice.
*/
// FIXME(https://bitwarden.atlassian.net/browse/CL-903): Migrate to Signals
// eslint-disable-next-line @angular-eslint/prefer-signals
@Input({ required: true })
account: Account = null!;
@@ -54,6 +58,8 @@ export class UsernameSettingsComponent implements OnInit, OnChanges, OnDestroy {
* to receive live settings updates including the initial update,
* use `CredentialGeneratorService.settings(...)` instead.
*/
// FIXME(https://bitwarden.atlassian.net/browse/CL-903): Migrate to Signals
// eslint-disable-next-line @angular-eslint/prefer-output-emitter-ref
@Output()
readonly onUpdated = new EventEmitter<EffUsernameGenerationOptions>();