Skip to content

Commit 729959c

Browse files
committed
feat: standalone components and pipes; root providers instead of forRoot(); removal of ngModules
1 parent 1aa382d commit 729959c

File tree

473 files changed

+3204
-4039
lines changed

Some content is hidden

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

473 files changed

+3204
-4039
lines changed

.global/integration-app.style.scss

Lines changed: 16 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,33 @@
11
@use '@angular/material' as mat;
22

3-
$theme: mat.define-theme(
3+
@include mat.core();
4+
5+
$ng-app-variable-primary: mat.m2-define-palette(mat.$m2-indigo-palette);
6+
$ng-app-variable-accent: mat.m2-define-palette(mat.$m2-pink-palette, A200, A100, A400);
7+
$ng-app-variable-warn: mat.m2-define-palette(mat.$m2-red-palette);
8+
9+
$ng-app-variable-theme: mat.m2-define-light-theme(
410
(
511
color: (
6-
theme-type: dark,
7-
primary: mat.$violet-palette,
8-
),
9-
typography: (
10-
brand-family: 'Comic Sans',
11-
bold-weight: 900,
12-
),
13-
density: (
14-
scale: -1,
12+
primary: $ng-app-variable-primary,
13+
accent: $ng-app-variable-accent,
14+
warn: $ng-app-variable-warn,
1515
),
16+
density: -1,
1617
)
1718
);
1819

19-
@include mat.core();
20+
@include mat.all-component-themes($ng-app-variable-theme);
21+
@include mat.form-field-density(-4);
2022

2123
html,
2224
body {
2325
height: 100%;
24-
25-
@include mat.core-theme($theme);
26-
@include mat.button-theme($theme);
27-
@include mat.core-color($theme);
28-
@include mat.button-color($theme);
2926
}
3027

3128
body {
3229
margin: 0;
33-
font-family:
34-
pfhighway,
35-
-apple-system,
36-
BlinkMacSystemFont,
37-
Segoe UI,
38-
Roboto,
39-
Helvetica,
40-
Arial,
41-
sans-serif;
30+
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
4231
}
4332

4433
a {
@@ -57,6 +46,8 @@ a {
5746
--mat-sidenav-container-background-color: rgb(24, 75, 170);
5847
--mat-sidenav-container-text-color: #fff;
5948
--mat-sidenav-container-width: 300px;
49+
--mat-toolbar-container-background-color: var(--mat-sidenav-container-background-color);
50+
--mat-toolbar-container-text-color: var(--mat-sidenav-container-text-color);
6051
}
6152

6253
.title {

apps/cdk-demo/main.ts

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
1-
import {enableProdMode} from '@angular/core';
2-
import {platformBrowser} from '@angular/platform-browser';
1+
import {bootstrapApplication} from '@angular/platform-browser';
32

4-
import {environment} from './environments/environment';
5-
import {AppModule} from './src/app.module';
3+
import {AppComponent} from './src/app.component';
4+
import {appConfig} from './src/app.config';
65

7-
if (environment.production) {
8-
enableProdMode();
9-
}
10-
11-
platformBrowser()
12-
.bootstrapModule(AppModule, {ngZoneEventCoalescing: true})
13-
.catch((error: unknown): void => console.error(error));
6+
bootstrapApplication(AppComponent, appConfig).catch((error: unknown) =>
7+
console.error(error),
8+
);

apps/cdk-demo/polyfills.ts

Lines changed: 0 additions & 2 deletions
This file was deleted.

apps/cdk-demo/project.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
"index": "apps/cdk-demo/index.html",
1616
"browser": "apps/cdk-demo/main.ts",
1717
"tsConfig": "apps/cdk-demo/tsconfig.app.json",
18-
"polyfills": ["apps/cdk-demo/polyfills.ts"],
1918
"inlineStyleLanguage": "scss",
2019
"assets": ["apps/cdk-demo/assets"],
2120
"styles": [".global/integration-app.style.scss", "apps/cdk-demo/styles.scss"],

apps/cdk-demo/src/app-routing.module.ts

Lines changed: 0 additions & 37 deletions
This file was deleted.

apps/cdk-demo/src/app.component.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,22 @@
11
import {ChangeDetectionStrategy, Component} from '@angular/core';
2+
import {MatDivider, MatList, MatListItem} from '@angular/material/list';
3+
import {MatDrawer, MatDrawerContainer, MatDrawerContent} from '@angular/material/sidenav';
4+
import {MatToolbar} from '@angular/material/toolbar';
5+
import {RouterLink, RouterOutlet} from '@angular/router';
26

37
@Component({
4-
standalone: false,
58
selector: 'app-root',
9+
imports: [
10+
MatDivider,
11+
MatDrawer,
12+
MatDrawerContainer,
13+
MatDrawerContent,
14+
MatList,
15+
MatListItem,
16+
MatToolbar,
17+
RouterLink,
18+
RouterOutlet,
19+
],
620
templateUrl: './app.component.html',
721
changeDetection: ChangeDetectionStrategy.OnPush,
822
})

apps/cdk-demo/src/app.config.ts

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import type {ApplicationConfig} from '@angular/core';
2+
import {
3+
provideBrowserGlobalErrorListeners,
4+
provideZonelessChangeDetection,
5+
} from '@angular/core';
6+
import {provideAnimationsAsync} from '@angular/platform-browser/animations/async';
7+
import {
8+
PreloadAllModules,
9+
provideRouter,
10+
withComponentInputBinding,
11+
withHashLocation,
12+
withInMemoryScrolling,
13+
withPreloading,
14+
withRouterConfig,
15+
} from '@angular/router';
16+
import {provideAmountFormat} from '@angular-ru/cdk/directives';
17+
18+
import {routes} from './app.routes';
19+
20+
export const appConfig: ApplicationConfig = {
21+
providers: [
22+
provideZonelessChangeDetection(),
23+
provideBrowserGlobalErrorListeners(),
24+
provideRouter(
25+
routes,
26+
withPreloading(PreloadAllModules),
27+
withRouterConfig({
28+
paramsInheritanceStrategy: 'always',
29+
}),
30+
withComponentInputBinding(),
31+
withInMemoryScrolling({
32+
scrollPositionRestoration: 'enabled',
33+
}),
34+
withHashLocation(),
35+
),
36+
provideAnimationsAsync(),
37+
provideAmountFormat(),
38+
],
39+
};

apps/cdk-demo/src/app.module.ts

Lines changed: 0 additions & 27 deletions
This file was deleted.

apps/cdk-demo/src/app.routes.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import type {Routes} from '@angular/router';
2+
import {provideInputFilter} from '@angular-ru/cdk/directives';
3+
4+
import {REG_EXP_ONLY_NUMBERS} from './samples/guide/properties/constants';
5+
6+
export const routes: Routes = [
7+
{
8+
path: '',
9+
pathMatch: 'full',
10+
redirectTo: 'samples',
11+
},
12+
{
13+
path: 'samples',
14+
children: [
15+
{
16+
path: '',
17+
pathMatch: 'full',
18+
redirectTo: 'guide',
19+
},
20+
{
21+
path: 'guide',
22+
loadComponent: async () => import('./samples/guide/guide.component'),
23+
providers: [
24+
provideInputFilter({
25+
default: REG_EXP_ONLY_NUMBERS,
26+
}),
27+
],
28+
},
29+
],
30+
},
31+
];

apps/cdk-demo/src/samples/guide/guide.component.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,25 @@
11
import {ChangeDetectionStrategy, Component} from '@angular/core';
2-
import {FormBuilder, FormControl, FormGroup} from '@angular/forms';
2+
import {FormBuilder, FormControl, FormGroup, ReactiveFormsModule} from '@angular/forms';
3+
import {MatFormField, MatInput, MatLabel} from '@angular/material/input';
4+
import {AmountFormat, InputFilter} from '@angular-ru/cdk/directives';
35

46
import {REG_EXP_ONLY_NUMBERS} from './properties/constants';
57

68
@Component({
7-
standalone: false,
89
selector: 'guide',
10+
imports: [
11+
AmountFormat,
12+
InputFilter,
13+
MatFormField,
14+
MatInput,
15+
MatLabel,
16+
ReactiveFormsModule,
17+
],
918
templateUrl: './guide.component.html',
1019
styleUrls: ['./guide.component.scss'],
1120
changeDetection: ChangeDetectionStrategy.OnPush,
1221
})
13-
export class GuideComponent {
22+
export default class GuideComponent {
1423
public value = 'abc';
1524
public valueNumbers = '123';
1625
public filterRegExp = /[a-z]+/;

0 commit comments

Comments
 (0)