Skip to content

Commit 53d3fda

Browse files
committed
refactor(multiple): switch to styleUrl for single stylesheets
Reworks all the usages of `styleUrls` with a single style sheet to use the new cleaner `styleUrl`.
1 parent f6b5f17 commit 53d3fda

File tree

364 files changed

+439
-499
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

364 files changed

+439
-499
lines changed

guides/creating-a-custom-stepper-using-the-cdk-stepper.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ Now we are ready to create our custom stepper component. Therefore, we need to c
1414

1515
```ts
1616
@Component({
17-
selector: "app-custom-stepper",
18-
templateUrl: "./custom-stepper.component.html",
19-
styleUrls: ["./custom-stepper.component.css"],
17+
selector: 'app-custom-stepper',
18+
templateUrl: './custom-stepper.component.html',
19+
styleUrl: './custom-stepper.component.css',
2020
// This custom stepper provides itself as CdkStepper so that it can be recognized
2121
// by other components.
2222
providers: [{ provide: CdkStepper, useExisting: CustomStepperComponent }]

src/cdk-experimental/scrolling/virtual-scroll-viewport.spec.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,7 @@ function finishInit(fixture: ComponentFixture<any>) {
8080
</div>
8181
</cdk-virtual-scroll-viewport>
8282
`,
83-
styles: [
84-
`
83+
styles: `
8584
.cdk-virtual-scroll-content-wrapper {
8685
display: flex;
8786
flex-direction: column;
@@ -91,7 +90,6 @@ function finishInit(fixture: ComponentFixture<any>) {
9190
flex-direction: row;
9291
}
9392
`,
94-
],
9593
encapsulation: ViewEncapsulation.None,
9694
standalone: true,
9795
imports: [ScrollingModule, ExperimentalScrollingModule],

src/cdk-experimental/table-scroll-container/table-scroll-container.spec.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -276,15 +276,13 @@ class FakeDataSource extends DataSource<TestData> {
276276
`,
277277
standalone: true,
278278
imports: [CdkTableModule, CdkTableScrollContainerModule],
279-
styles: [
280-
`
279+
styles: `
281280
.cdk-header-cell, .cdk-cell, .cdk-footer-cell {
282281
display: block;
283282
width: 20px;
284283
box-sizing: border-box;
285284
}
286285
`,
287-
],
288286
})
289287
class StickyNativeLayoutCdkTableApp {
290288
dataSource: FakeDataSource = new FakeDataSource();

src/cdk/dialog/dialog-container.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export function throwDialogContentAlreadyAttachedError() {
5151
@Component({
5252
selector: 'cdk-dialog-container',
5353
templateUrl: './dialog-container.html',
54-
styleUrls: ['dialog-container.css'],
54+
styleUrl: 'dialog-container.css',
5555
encapsulation: ViewEncapsulation.None,
5656
// Using OnPush for dialogs caused some G3 sync issues. Disabled until we can track them down.
5757
// tslint:disable-next-line:validate-decorators

src/cdk/drag-drop/directives/drag.spec.ts

+12-34
Original file line numberDiff line numberDiff line change
@@ -6833,8 +6833,7 @@ class StandaloneDraggableWithShadowInsideHandle {
68336833

68346834
@Component({
68356835
encapsulation: ViewEncapsulation.None,
6836-
styles: [
6837-
`
6836+
styles: `
68386837
.cdk-drag-handle {
68396838
position: absolute;
68406839
top: 0;
@@ -6843,7 +6842,6 @@ class StandaloneDraggableWithShadowInsideHandle {
68436842
height: 10px;
68446843
}
68456844
`,
6846-
],
68476845
template: `
68486846
<div #dragElement cdkDrag
68496847
style="width: 100px; height: 100px; background: red; position: relative">
@@ -6936,15 +6934,13 @@ class ConnectedDropListsInOnPush {}
69366934

69376935
// Note that it needs a margin to ensure that it's not flush against the viewport
69386936
// edge which will cause the viewport to scroll, rather than the list.
6939-
styles: [
6940-
`
6937+
styles: `
69416938
.drop-list {
69426939
max-height: 200px;
69436940
overflow: auto;
69446941
margin: 10vw 0 0 10vw;
69456942
}
69466943
`,
6947-
],
69486944
})
69496945
class DraggableInScrollableVerticalDropZone extends DraggableInDropZone {
69506946
constructor(elementRef: ElementRef) {
@@ -6965,15 +6961,13 @@ class DraggableInScrollableVerticalDropZone extends DraggableInDropZone {
69656961

69666962
// Note that it needs a margin to ensure that it's not flush against the viewport
69676963
// edge which will cause the viewport to scroll, rather than the list.
6968-
styles: [
6969-
`
6964+
styles: `
69706965
.scroll-container {
69716966
max-height: 200px;
69726967
overflow: auto;
69736968
margin: 10vw 0 0 10vw;
69746969
}
69756970
`,
6976-
],
69776971
})
69786972
class DraggableInScrollableParentContainer extends DraggableInDropZone implements AfterViewInit {
69796973
@ViewChild('scrollContainer') scrollContainer: ElementRef<HTMLElement>;
@@ -7058,7 +7052,7 @@ const HORIZONTAL_FIXTURE_TEMPLATE = `
70587052

70597053
@Component({
70607054
encapsulation: ViewEncapsulation.None,
7061-
styles: [HORIZONTAL_FIXTURE_STYLES],
7055+
styles: HORIZONTAL_FIXTURE_STYLES,
70627056
template: HORIZONTAL_FIXTURE_TEMPLATE,
70637057
})
70647058
class DraggableInHorizontalDropZone implements AfterViewInit {
@@ -7211,13 +7205,11 @@ class DraggableInDropZoneWithCustomMultiNodePreview {
72117205
}
72127206
</div>
72137207
`,
7214-
styles: [
7215-
`
7208+
styles: `
72167209
.tall-placeholder {
72177210
height: ${ITEM_HEIGHT * 3}px;
72187211
}
72197212
`,
7220-
],
72217213
})
72227214
class DraggableInDropZoneWithCustomPlaceholder {
72237215
@ViewChildren(CdkDrag) dragItems: QueryList<CdkDrag>;
@@ -7364,8 +7356,7 @@ class ConnectedDropZonesInsideShadowRootWithNgIf extends ConnectedDropZones {}
73647356

73657357
@Component({
73667358
encapsulation: ViewEncapsulation.None,
7367-
styles: [
7368-
`
7359+
styles: `
73697360
.cdk-drop-list {
73707361
display: block;
73717362
width: 100px;
@@ -7379,7 +7370,6 @@ class ConnectedDropZonesInsideShadowRootWithNgIf extends ConnectedDropZones {}
73797370
background: red;
73807371
}
73817372
`,
7382-
],
73837373
template: `
73847374
<div cdkDropListGroup [cdkDropListGroupDisabled]="groupDisabled">
73857375
<div
@@ -7426,8 +7416,7 @@ class DraggableWithAlternateRoot {
74267416

74277417
@Component({
74287418
encapsulation: ViewEncapsulation.None,
7429-
styles: [
7430-
`
7419+
styles: `
74317420
.cdk-drop-list {
74327421
display: block;
74337422
width: 100px;
@@ -7441,7 +7430,6 @@ class DraggableWithAlternateRoot {
74417430
background: red;
74427431
}
74437432
`,
7444-
],
74457433
template: `
74467434
<div
74477435
cdkDropList
@@ -7534,8 +7522,7 @@ class DraggableInDropZoneWithoutEvents {
75347522

75357523
@Component({
75367524
encapsulation: ViewEncapsulation.None,
7537-
styles: [
7538-
`
7525+
styles: `
75397526
.cdk-drop-list {
75407527
display: block;
75417528
width: 100px;
@@ -7549,7 +7536,6 @@ class DraggableInDropZoneWithoutEvents {
75497536
background: red;
75507537
}
75517538
`,
7552-
],
75537539
template: `
75547540
<div cdkDropListGroup>
75557541
<wrapped-drop-container [items]="todo"></wrapped-drop-container>
@@ -7659,8 +7645,7 @@ class WrappedDropContainerComponent {
76597645
}
76607646

76617647
@Component({
7662-
styles: [
7663-
`
7648+
styles: `
76647649
:host {
76657650
height: 400px;
76667651
width: 400px;
@@ -7677,7 +7662,6 @@ class WrappedDropContainerComponent {
76777662
position: absolute;
76787663
}
76797664
`,
7680-
],
76817665
template: `
76827666
<div
76837667
cdkDrag
@@ -7709,8 +7693,7 @@ class NestedDragsComponent {
77097693
}
77107694

77117695
@Component({
7712-
styles: [
7713-
`
7696+
styles: `
77147697
:host {
77157698
height: 400px;
77167699
width: 400px;
@@ -7727,7 +7710,6 @@ class NestedDragsComponent {
77277710
position: absolute;
77287711
}
77297712
`,
7730-
],
77317713
template: `
77327714
<div
77337715
cdkDrag
@@ -7757,14 +7739,12 @@ class NestedDragsThroughTemplate {
77577739
}
77587740

77597741
@Component({
7760-
styles: [
7761-
`
7742+
styles: `
77627743
.drop-list {
77637744
width: 100px;
77647745
background: pink;
77657746
}
77667747
`,
7767-
],
77687748
template: `
77697749
<div cdkDropList class="drop-list" #outerList>
77707750
<div cdkDropList class="drop-list" #innerList>
@@ -7799,8 +7779,7 @@ class PlainStandaloneDropList {
77997779
}
78007780

78017781
@Component({
7802-
styles: [
7803-
`
7782+
styles: `
78047783
.list {
78057784
display: flex;
78067785
width: 100px;
@@ -7814,7 +7793,6 @@ class PlainStandaloneDropList {
78147793
min-height: 50px;
78157794
}
78167795
`,
7817-
],
78187796
template: `
78197797
<div class="list" cdkDropList cdkDropListOrientation="horizontal">
78207798
@for (item of items; track item) {

src/cdk/scrolling/scrollable.spec.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,7 @@ describe('CdkScrollable', () => {
227227
<div #lastRowEnd class="cell"></div>
228228
</div>
229229
</div>`,
230-
styles: [
231-
`
230+
styles: `
232231
.scroll-container {
233232
width: 100px;
234233
height: 100px;
@@ -246,7 +245,6 @@ describe('CdkScrollable', () => {
246245
height: 100px;
247246
}
248247
`,
249-
],
250248
standalone: true,
251249
imports: [ScrollingModule],
252250
})

0 commit comments

Comments
 (0)