Skip to content

Commit

Permalink
refactor(core): add REQUEST, RESPONSE_INIT and REQUEST_CONTEXT
Browse files Browse the repository at this point in the history
…tokens

This commit introduces the `REQUEST`, `RESPONSE_INIT` and `REQUEST_CONTEXT` tokens, which will replace similar ones from https://github.com/angular/angular-cli/blob/28503186230b5e22b84499641d56c9c981fdab1d/packages/angular/ssr/tokens/src/tokens.ts, so those tokens would be imported in application code via `@angular/core` package.
  • Loading branch information
jelbourn authored and AndrewKushnir committed Nov 14, 2024
1 parent 648c845 commit ac38042
Show file tree
Hide file tree
Showing 322 changed files with 101 additions and 411 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {RouterTestingHarness} from '@angular/router/testing';
describe('navigate for test examples', () => {
// #docregion RoutedComponent
it('navigates to routed component', async () => {
@Component({standalone: true, template: 'hello {{name}}'})
@Component({template: 'hello {{name}}'})
class TestCmp {
name = 'world';
}
Expand All @@ -32,9 +32,9 @@ describe('navigate for test examples', () => {
// #enddocregion

it('testing a guard', async () => {
@Component({standalone: true, template: ''})
@Component({template: ''})
class AdminComponent {}
@Component({standalone: true, template: ''})
@Component({template: ''})
class LoginComponent {}

// #docregion Guard
Expand Down
4 changes: 2 additions & 2 deletions adev/src/content/best-practices/style-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -293,8 +293,8 @@ Provides a consistent way to quickly identify and reference pipes.

| Symbol name | File name |
|:--- |:--- |
| <docs-code hideCopy language="typescript"> @Pipe({ standalone: true, name: 'ellipsis' }) <br>export class EllipsisPipe implements PipeTransform { } </docs-code> | ellipsis.pipe.ts |
| <docs-code hideCopy language="typescript"> @Pipe({ standalone: true, name: 'initCaps' }) <br>export class InitCapsPipe implements PipeTransform { } </docs-code> | init-caps.pipe.ts |
| <docs-code hideCopy language="typescript"> @Pipe({ name: 'ellipsis' }) <br>export class EllipsisPipe implements PipeTransform { } </docs-code> | ellipsis.pipe.ts |
| <docs-code hideCopy language="typescript"> @Pipe({ name: 'initCaps' }) <br>export class InitCapsPipe implements PipeTransform { } </docs-code> | init-caps.pipe.ts |

### Unit test file names

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import {Component} from '@angular/core';
import {ExampleProgressbarComponent} from './progress-bar.component';

@Component({
standalone: true,
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {Component, Input} from '@angular/core';
* Example progressbar component.
*/
@Component({
standalone: true,
selector: 'app-example-progressbar',
template: '<div class="bar" [style.width.%]="value"></div>',
styleUrls: ['./progress-bar.component.css'],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {Component} from '@angular/core';

@Component({
standalone: true,
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css'],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {Component} from '@angular/core';

@Component({
standalone: true,
selector: 'app-about',
templateUrl: './about.component.html',
styleUrls: ['./about.component.css'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import {slideInAnimation} from './animations';

// #docregion decorator, toggle-app-animations, define
@Component({
standalone: true,
selector: 'app-root',
templateUrl: 'app.component.html',
styleUrls: ['app.component.css'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {HEROES} from './mock-heroes';
import {HeroListAutoComponent} from './hero-list-auto.component';

@Component({
standalone: true,
selector: 'app-hero-list-auto-page',
template: `
<section>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {Hero} from './hero';
import {NgFor} from '@angular/common';

@Component({
standalone: true,
selector: 'app-hero-list-auto',
templateUrl: 'hero-list-auto.component.html',
styleUrls: ['./hero-list-page.component.css'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {HEROES} from './mock-heroes';
import {HeroListEnterLeaveComponent} from './hero-list-enter-leave.component';

@Component({
standalone: true,
selector: 'app-hero-list-enter-leave-page',
template: `
<section>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {Hero} from './hero';
import {NgFor} from '@angular/common';

@Component({
standalone: true,
selector: 'app-hero-list-enter-leave',
template: `
<ul class="heroes">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {HEROES} from './mock-heroes';
import {HeroListGroupsComponent} from './hero-list-groups.component';

@Component({
standalone: true,
selector: 'app-hero-list-groups-page',
template: `
<section>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {Hero} from './hero';
import {NgFor} from '@angular/common';

@Component({
standalone: true,
selector: 'app-hero-list-groups',
template: `
<ul class="heroes">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {NgFor} from '@angular/common';
// #docregion filter-animations
@Component({
// #enddocregion filter-animations
standalone: true,
imports: [NgFor],
selector: 'app-hero-list-page',
templateUrl: 'hero-list-page.component.html',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {Component} from '@angular/core';

@Component({
standalone: true,
selector: 'app-home',
templateUrl: './home.component.html',
styleUrls: ['./home.component.css'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {trigger, transition, animate, style} from '@angular/animations';
import {NgIf} from '@angular/common';

@Component({
standalone: true,
selector: 'app-insert-remove',
imports: [NgIf],
animations: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import {Component} from '@angular/core';
import {OpenCloseComponent} from './open-close.component';

@Component({
standalone: true,
selector: 'app-open-close-page',
template: `
<section>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
} from '@angular/animations';

@Component({
standalone: true,
selector: 'app-open-close',
animations: [
// #docregion trigger
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import {Component} from '@angular/core';
import {trigger, transition, state, animate, style} from '@angular/animations';

@Component({
standalone: true,
selector: 'app-open-close-boolean',
// #docregion trigger-boolean
animations: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {transition, trigger, useAnimation, AnimationEvent} from '@angular/animat
import {transitionAnimation} from './animations';

@Component({
standalone: true,
selector: 'app-open-close-reusable',
animations: [
trigger('openClose', [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {trigger, transition, state, animate, style} from '@angular/animations';
// #docregion toggle-animation
@Component({
// #enddocregion toggle-animation
standalone: true,
selector: 'app-open-close-toggle',
templateUrl: 'open-close.component.4.html',
styleUrls: ['open-close.component.css'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {trigger, transition, state, animate, style, AnimationEvent} from '@angul

// #docregion component, events1
@Component({
standalone: true,
selector: 'app-open-close',
// #docregion trigger-wildcard1, trigger-transition
animations: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import {HEROES} from './mock-heroes';
import {NgIf} from '@angular/common';

@Component({
standalone: true,
selector: 'app-querying',
template: `
<nav>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import {Component} from '@angular/core';
import {StatusSliderComponent} from './status-slider.component';

@Component({
standalone: true,
selector: 'app-status-slider-page',
template: `
<section>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import {Component} from '@angular/core';
import {trigger, transition, state, animate, style, keyframes} from '@angular/animations';

@Component({
standalone: true,
selector: 'app-status-slider',
templateUrl: 'status-slider.component.html',
styleUrls: ['status-slider.component.css'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import {Component} from '@angular/core';
import {OpenCloseChildComponent} from './open-close.component.4';

@Component({
standalone: true,
selector: 'app-toggle-animations-child-page',
template: `
<section>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import {Component} from '@angular/core';
import {HighlightDirective} from './highlight.directive';

@Component({
standalone: true,
selector: 'app-root',
templateUrl: './app.component.1.html',
imports: [HighlightDirective],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {Component} from '@angular/core';
import {HighlightDirective} from './highlight.directive';

@Component({
standalone: true,
selector: 'app-root',
templateUrl: './app.component.html',
imports: [HighlightDirective],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import {Directive} from '@angular/core';

@Directive({
standalone: true,
selector: '[appHighlight]',
})
export class HighlightDirective {}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import {Directive, ElementRef} from '@angular/core';

@Directive({
standalone: true,
selector: '[appHighlight]',
})
export class HighlightDirective {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {Input} from '@angular/core';
// #docregion

@Directive({
standalone: true,
selector: '[appHighlight]',
})
export class HighlightDirective {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {Directive, ElementRef, HostListener, Input} from '@angular/core';
// #enddocregion imports

@Directive({
standalone: true,
selector: '[appHighlight]',
})
export class HighlightDirective {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {Directive, ElementRef, HostListener, Input} from '@angular/core';

@Directive({
standalone: true,
selector: '[appHighlight]',
})
export class HighlightDirective {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import {StoutItemComponent} from './item-switch.component';

// #docregion import-ng-if, import-ng-for, import-ng-switch, import-ng-style, import-ng-class, import-forms-module
@Component({
standalone: true,
// #enddocregion import-ng-if, import-ng-for, import-ng-switch, import-ng-style, import-ng-class, import-forms-module
selector: 'app-root',
templateUrl: './app.component.html',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {Component, Input} from '@angular/core';
import {Item} from '../item';

@Component({
standalone: true,
selector: 'app-item-detail',
templateUrl: './item-detail.component.html',
styleUrls: ['./item-detail.component.css'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import {Component, Input} from '@angular/core';
import {Item} from './item';

@Component({
standalone: true,
selector: 'app-stout-item',
template: "I'm a little {{item.name}}, short and stout!",
})
Expand All @@ -14,7 +13,6 @@ export class StoutItemComponent {
// #enddocregion input

@Component({
standalone: true,
selector: 'app-best-item',
template: 'This is the brightest {{item.name}} in town.',
})
Expand All @@ -23,7 +21,6 @@ export class BestItemComponent {
}

@Component({
standalone: true,
selector: 'app-device-item',
template: 'Which is the slimmest {{item.name}}?',
})
Expand All @@ -32,7 +29,6 @@ export class DeviceItemComponent {
}

@Component({
standalone: true,
selector: 'app-lost-item',
template: 'Has anyone seen my {{item.name}}?',
})
Expand All @@ -41,7 +37,6 @@ export class LostItemComponent {
}

@Component({
standalone: true,
selector: 'app-unknown-item',
template: '{{message}}',
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {CarComponent} from './car/car.component';
import {HeroesComponent} from './heroes/heroes.component';

@Component({
standalone: true,
selector: 'app-root',
template: `
<h1>{{title}}</h1>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {CarComponent} from './car/car.component';
import {HeroesComponent} from './heroes/heroes.component';

@Component({
standalone: true,
selector: 'app-root',
template: `
<h1>{{title}}</h1>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {TestComponent} from './test.component';
import {NgIf} from '@angular/common';

@Component({
standalone: true,
selector: 'app-root',
template: `
<h1>{{title}}</h1>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {testCar, simpleCar, superCar} from './car-creations';
import {useInjector} from './car-injector';

@Component({
standalone: true,
selector: 'app-car',
template: `
<h2>Cars</h2>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {Component} from '@angular/core';
import {HEROES} from './mock-heroes';

@Component({
standalone: true,
selector: 'app-hero-list',
template: `
@for (hero of heroes; track hero) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { HeroService } from './hero.service';
// #docregion

@Component({
standalone: true,
selector: 'app-hero-list',
template: `
@for (hero of heroes; track hero) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {HeroService} from './hero.service';
import {NgFor} from '@angular/common';

@Component({
standalone: true,
selector: 'app-hero-list',
template: `
@for (hero of heroes; track hero) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {HeroListComponent} from './hero-list.component';
* TSP stands for Tree-Shakeable Provider.
*/
@Component({
standalone: true,
selector: 'app-heroes-tsp',
template: `
<h2>Heroes</h2>
Expand Down
Loading

0 comments on commit ac38042

Please sign in to comment.