From 78afe889fdde8657deefa98ec4d06e08c371a4ee Mon Sep 17 00:00:00 2001 From: AleksanderBodurri Date: Wed, 30 Aug 2023 18:41:16 -0400 Subject: [PATCH] refactor(devtools): migrate material legacy components to mdc (#51590) Removes all legacy angular material imports and moves devtools over to mdc. PR Close #51590 --- .../projects/demo-standalone/src/BUILD.bazel | 2 +- .../src/app/demo-app/todo/dialog.component.ts | 4 +- .../app/demo-app/todo/todo-app.component.ts | 6 +- .../projects/demo-standalone/src/styles.scss | 49 +------------ .../devtools-tabs.component.html | 41 ++++++----- .../devtools-tabs.component.scss | 71 ++++++++++--------- .../devtools-tabs/devtools-tabs.component.ts | 14 ++-- .../lib/devtools-tabs/devtools-tabs.module.ts | 10 +-- .../directive-explorer.module.ts | 8 +-- .../breadcrumbs/breadcrumbs.component.scss | 11 +-- .../breadcrumbs/breadcrumbs.module.ts | 4 +- .../directive-forest.module.ts | 4 +- .../filter/filter.component.html | 8 ++- .../filter/filter.component.scss | 36 ++++++---- .../directive-forest/filter/filter.module.ts | 4 +- .../property-tab/property-tab.module.ts | 4 +- .../property-view-header.component.html | 2 +- .../property-view-header.component.scss | 24 +++++-- .../property-view/property-view.module.ts | 4 +- .../profiler-import-dialog.component.ts | 2 +- .../profiler/profiler.component.scss | 22 +++--- .../profiler/profiler.component.ts | 2 +- .../devtools-tabs/profiler/profiler.module.ts | 10 +-- .../timeline/frame-selector.component.html | 2 + .../timeline/frame-selector.component.scss | 6 ++ .../recording-visualizer.module.ts | 4 +- .../timeline/timeline-controls.component.scss | 6 +- .../profiler/timeline/timeline.module.ts | 16 ++--- .../router-tree/router-tree.module.ts | 2 +- .../ng-devtools/src/lib/devtools.module.ts | 4 +- .../app/demo-app/todo/app-todo.component.ts | 2 +- devtools/src/app/demo-app/todo/app.module.ts | 6 +- .../src/app/demo-app/todo/dialog.component.ts | 2 +- devtools/styles.scss | 20 ++++-- 34 files changed, 209 insertions(+), 203 deletions(-) diff --git a/devtools/projects/demo-standalone/src/BUILD.bazel b/devtools/projects/demo-standalone/src/BUILD.bazel index 76ff76d8810..f6c2f1638cf 100644 --- a/devtools/projects/demo-standalone/src/BUILD.bazel +++ b/devtools/projects/demo-standalone/src/BUILD.bazel @@ -11,7 +11,7 @@ sass_binary( src = "styles.scss", include_paths = ["external/npm/node_modules"], sourcemap = False, - deps = ["//devtools:material_sass_deps"], + deps = ["//devtools:global_styles"], ) sass_binary( diff --git a/devtools/projects/demo-standalone/src/app/demo-app/todo/dialog.component.ts b/devtools/projects/demo-standalone/src/app/demo-app/todo/dialog.component.ts index c0cbda8eb65..4f416594ebe 100644 --- a/devtools/projects/demo-standalone/src/app/demo-app/todo/dialog.component.ts +++ b/devtools/projects/demo-standalone/src/app/demo-app/todo/dialog.component.ts @@ -9,8 +9,8 @@ import {CommonModule} from '@angular/common'; import {Component, Inject} from '@angular/core'; import {FormsModule} from '@angular/forms'; -import {MAT_LEGACY_DIALOG_DATA as MAT_DIALOG_DATA, MatLegacyDialogModule as MatDialogModule, MatLegacyDialogRef as MatDialogRef} from '@angular/material/legacy-dialog'; -import {MatLegacyFormFieldModule as MatFormFieldModule} from '@angular/material/legacy-form-field'; +import {MAT_DIALOG_DATA, MatDialogModule, MatDialogRef} from '@angular/material/dialog'; +import {MatFormFieldModule} from '@angular/material/form-field'; export interface DialogData { diff --git a/devtools/projects/demo-standalone/src/app/demo-app/todo/todo-app.component.ts b/devtools/projects/demo-standalone/src/app/demo-app/todo/todo-app.component.ts index 1ab429e754d..87cbca71a9a 100644 --- a/devtools/projects/demo-standalone/src/app/demo-app/todo/todo-app.component.ts +++ b/devtools/projects/demo-standalone/src/app/demo-app/todo/todo-app.component.ts @@ -9,9 +9,9 @@ import {CommonModule} from '@angular/common'; import {Component} from '@angular/core'; import {FormsModule} from '@angular/forms'; -import {MatLegacyDialog as MatDialog, MatLegacyDialogModule as MatDialogModule} from '@angular/material/legacy-dialog'; -import {MatLegacyFormFieldModule as MatFormFieldModule} from '@angular/material/legacy-form-field'; -import {MatLegacyInputModule as MatInputModule} from '@angular/material/legacy-input'; +import {MatDialog, MatDialogModule} from '@angular/material/dialog'; +import {MatFormFieldModule} from '@angular/material/form-field'; +import {MatInputModule} from '@angular/material/input'; import {RouterLink, RouterOutlet} from '@angular/router'; import {DialogComponent} from './dialog.component'; diff --git a/devtools/projects/demo-standalone/src/styles.scss b/devtools/projects/demo-standalone/src/styles.scss index bb87d3e30fd..b5f91b71cf6 100644 --- a/devtools/projects/demo-standalone/src/styles.scss +++ b/devtools/projects/demo-standalone/src/styles.scss @@ -1,48 +1 @@ -@use 'sass:map'; -@use 'external/npm/node_modules/@angular/material/index' as mat; -@include mat.all-legacy-component-typographies(); -@include mat.legacy-core(); - -html, -body { - padding: 0; - margin: 0; -} - -// Light theme -$light-primary: mat.define-palette(mat.$grey-palette, 700, 200); -$light-accent: mat.define-palette(mat.$blue-palette, 800); -$light-theme: mat.define-light-theme($light-primary, $light-accent); - -// Dark theme -$dark-primary: mat.define-palette(mat.$blue-grey-palette, 50); -$dark-accent: mat.define-palette(mat.$blue-palette, 200); -$dark-theme: map.deep-merge( - mat.define-dark-theme($dark-primary, $dark-accent), - ( - 'color': ( - 'background': ( - background: #202124, - card: #202124, - ), - 'foreground': ( - text: #bcc5ce, - ), - ), - 'background': ( - background: #202124, - card: #202124, - ), - 'foreground': ( - 'text': #bcc5ce, - ), - ) -); - -.light-theme { - @include mat.all-legacy-component-themes($light-theme); -} - -.dark-theme { - @include mat.all-legacy-component-themes($dark-theme); -} +@use '../../../styles.scss' as devtools; diff --git a/devtools/projects/ng-devtools/src/lib/devtools-tabs/devtools-tabs.component.html b/devtools/projects/ng-devtools/src/lib/devtools-tabs/devtools-tabs.component.html index 4a830175f65..74eb0ed70e4 100644 --- a/devtools/projects/ng-devtools/src/lib/devtools-tabs/devtools-tabs.component.html +++ b/devtools/projects/ng-devtools/src/lib/devtools-tabs/devtools-tabs.component.html @@ -1,18 +1,23 @@ -