@angular/router 16.0.0-next.5 → 16.0.0-next.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v16.0.0-next.5
2
+ * @license Angular v16.0.0-next.6
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -109,16 +109,16 @@ class RouterTestingModule {
109
109
  ]
110
110
  };
111
111
  }
112
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.5", ngImport: i0, type: RouterTestingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
113
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.0.0-next.5", ngImport: i0, type: RouterTestingModule, exports: [RouterModule] }); }
114
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.0.0-next.5", ngImport: i0, type: RouterTestingModule, providers: [
112
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.6", ngImport: i0, type: RouterTestingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
113
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.0.0-next.6", ngImport: i0, type: RouterTestingModule, exports: [RouterModule] }); }
114
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.0.0-next.6", ngImport: i0, type: RouterTestingModule, providers: [
115
115
  ɵROUTER_PROVIDERS,
116
116
  provideLocationMocks(),
117
117
  ɵwithPreloading(NoPreloading).ɵproviders,
118
118
  { provide: ROUTES, multi: true, useValue: [] },
119
119
  ], imports: [RouterModule] }); }
120
120
  }
121
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.5", ngImport: i0, type: RouterTestingModule, decorators: [{
121
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.6", ngImport: i0, type: RouterTestingModule, decorators: [{
122
122
  type: NgModule,
123
123
  args: [{
124
124
  exports: [RouterModule],
@@ -147,18 +147,18 @@ class RootFixtureService {
147
147
  this.fixture.detectChanges();
148
148
  return this.fixture;
149
149
  }
150
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.5", ngImport: i0, type: RootFixtureService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
151
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.0-next.5", ngImport: i0, type: RootFixtureService, providedIn: 'root' }); }
150
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.6", ngImport: i0, type: RootFixtureService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
151
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.0-next.6", ngImport: i0, type: RootFixtureService, providedIn: 'root' }); }
152
152
  }
153
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.5", ngImport: i0, type: RootFixtureService, decorators: [{
153
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.6", ngImport: i0, type: RootFixtureService, decorators: [{
154
154
  type: Injectable,
155
155
  args: [{ providedIn: 'root' }]
156
156
  }] });
157
157
  class RootCmp {
158
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.5", ngImport: i0, type: RootCmp, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
159
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.0-next.5", type: RootCmp, isStandalone: true, selector: "ng-component", viewQueries: [{ propertyName: "outlet", first: true, predicate: RouterOutlet, descendants: true }], ngImport: i0, template: '<router-outlet></router-outlet>', isInline: true, dependencies: [{ kind: "directive", type: RouterOutlet, selector: "router-outlet", inputs: ["name"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }] }); }
158
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.6", ngImport: i0, type: RootCmp, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
159
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.0-next.6", type: RootCmp, isStandalone: true, selector: "ng-component", viewQueries: [{ propertyName: "outlet", first: true, predicate: RouterOutlet, descendants: true }], ngImport: i0, template: '<router-outlet></router-outlet>', isInline: true, dependencies: [{ kind: "directive", type: RouterOutlet, selector: "router-outlet", inputs: ["name"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }] }); }
160
160
  }
161
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.5", ngImport: i0, type: RootCmp, decorators: [{
161
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.6", ngImport: i0, type: RootCmp, decorators: [{
162
162
  type: Component,
163
163
  args: [{
164
164
  standalone: true,
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v16.0.0-next.5
2
+ * @license Angular v16.0.0-next.6
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
package/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v16.0.0-next.5
2
+ * @license Angular v16.0.0-next.6
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -710,6 +710,16 @@ export declare class ChildrenOutletContexts {
710
710
  static ɵprov: i0.ɵɵInjectableDeclaration<ChildrenOutletContexts>;
711
711
  }
712
712
 
713
+ /**
714
+ * A type alias for providers returned by `withComponentInputBinding` for use with `provideRouter`.
715
+ *
716
+ * @see `withComponentInputBinding`
717
+ * @see `provideRouter`
718
+ *
719
+ * @publicApi
720
+ */
721
+ declare type ComponentInputBindingFeature = RouterFeature<RouterFeatureKind.ComponentInputBindingFeature>;
722
+
713
723
  /**
714
724
  * Converts a `Params` instance to a `ParamMap`.
715
725
  * @param params The instance to convert.
@@ -1013,6 +1023,11 @@ export declare interface ExtraOptions extends InMemoryScrollingOptions, RouterCo
1013
1023
  * starts its initial navigation due to some complex initialization logic.
1014
1024
  */
1015
1025
  initialNavigation?: InitialNavigation;
1026
+ /**
1027
+ * When true, enables binding information from the `Router` state directly to the inputs of the
1028
+ * component in `Route` configurations.
1029
+ */
1030
+ bindToComponentInputs?: boolean;
1016
1031
  /**
1017
1032
  * A custom error handler for failed navigations.
1018
1033
  * If the handler returns a value, the navigation Promise is resolved with this value.
@@ -1107,7 +1122,9 @@ export declare class GuardsCheckStart extends RouterEvent {
1107
1122
  declare namespace i1 {
1108
1123
  export {
1109
1124
  RouterOutletContract,
1110
- RouterOutlet
1125
+ RouterOutlet,
1126
+ INPUT_BINDER,
1127
+ RoutedComponentInputBinder
1111
1128
  }
1112
1129
  }
1113
1130
 
@@ -1226,6 +1243,8 @@ export declare interface InMemoryScrollingOptions {
1226
1243
  scrollPositionRestoration?: 'disabled' | 'enabled' | 'top';
1227
1244
  }
1228
1245
 
1246
+ declare const INPUT_BINDER: InjectionToken<RoutedComponentInputBinder>;
1247
+
1229
1248
  /**
1230
1249
  * A set of options which specify how to determine if a `UrlTree` is active, given the `UrlTree`
1231
1250
  * for the current router state.
@@ -2641,6 +2660,29 @@ export declare class RouteConfigLoadStart {
2641
2660
  toString(): string;
2642
2661
  }
2643
2662
 
2663
+ /**
2664
+ * Injectable used as a tree-shakable provider for opting in to binding router data to component
2665
+ * inputs.
2666
+ *
2667
+ * The RouterOutlet registers itself with this service when an `ActivatedRoute` is attached or
2668
+ * activated. When this happens, the service subscribes to the `ActivatedRoute` observables (params,
2669
+ * queryParams, data) and sets the inputs of the component using `ComponentRef.setInput`.
2670
+ * Importantly, when an input does not have an item in the route data with a matching key, this
2671
+ * input is set to `undefined`. If it were not done this way, the previous information would be
2672
+ * retained if the data got removed from the route (i.e. if a query parameter is removed).
2673
+ *
2674
+ * The `RouterOutlet` should unregister itself when destroyed via `unsubscribeFromRouteData` so that
2675
+ * the subscriptions are cleaned up.
2676
+ */
2677
+ declare class RoutedComponentInputBinder {
2678
+ private outletDataSubscriptions;
2679
+ bindActivatedRouteToOutletComponent(outlet: RouterOutlet): void;
2680
+ unsubscribeFromRouteData(outlet: RouterOutlet): void;
2681
+ private subscribeToRouteData;
2682
+ static ɵfac: i0.ɵɵFactoryDeclaration<RoutedComponentInputBinder, never>;
2683
+ static ɵprov: i0.ɵɵInjectableDeclaration<RoutedComponentInputBinder>;
2684
+ }
2685
+
2644
2686
  /**
2645
2687
  * @description
2646
2688
  *
@@ -2800,6 +2842,13 @@ export declare class Router {
2800
2842
  private readonly navigationTransitions;
2801
2843
  private readonly urlSerializer;
2802
2844
  private readonly location;
2845
+ /**
2846
+ * Indicates whether the the application has opted in to binding Router data to component inputs.
2847
+ *
2848
+ * This option is enabled by the `withComponentInputBinding` feature of `provideRouter` or
2849
+ * `bindToComponentInputs` in the `ExtraOptions` of `RouterModule.forRoot`.
2850
+ */
2851
+ readonly componentInputBindingEnabled: boolean;
2803
2852
  constructor();
2804
2853
  /**
2805
2854
  * Sets up the location change listener and performs the initial navigation.
@@ -3167,7 +3216,8 @@ declare const enum RouterFeatureKind {
3167
3216
  InMemoryScrollingFeature = 4,
3168
3217
  RouterConfigurationFeature = 5,
3169
3218
  RouterHashLocationFeature = 6,
3170
- NavigationErrorHandlerFeature = 7
3219
+ NavigationErrorHandlerFeature = 7,
3220
+ ComponentInputBindingFeature = 8
3171
3221
  }
3172
3222
 
3173
3223
  /**
@@ -3180,7 +3230,7 @@ declare const enum RouterFeatureKind {
3180
3230
  *
3181
3231
  * @publicApi
3182
3232
  */
3183
- export declare type RouterFeatures = PreloadingFeature | DebugTracingFeature | InitialNavigationFeature | InMemoryScrollingFeature | RouterConfigurationFeature | NavigationErrorHandlerFeature;
3233
+ export declare type RouterFeatures = PreloadingFeature | DebugTracingFeature | InitialNavigationFeature | InMemoryScrollingFeature | RouterConfigurationFeature | NavigationErrorHandlerFeature | ComponentInputBindingFeature;
3184
3234
 
3185
3235
  /**
3186
3236
  * A type alias for providers returned by `withHashLocation` for use with `provideRouter`.
@@ -3678,6 +3728,9 @@ export declare class RouterOutlet implements OnDestroy, OnInit, RouterOutletCont
3678
3728
  private location;
3679
3729
  private changeDetector;
3680
3730
  private environmentInjector;
3731
+ private inputBinder;
3732
+ /** @nodoc */
3733
+ readonly supportsBindingToComponentInputs = true;
3681
3734
  /** @nodoc */
3682
3735
  ngOnChanges(changes: SimpleChanges): void;
3683
3736
  /** @nodoc */
@@ -3778,6 +3831,15 @@ export declare interface RouterOutletContract {
3778
3831
  * subtree.
3779
3832
  */
3780
3833
  detachEvents?: EventEmitter<unknown>;
3834
+ /**
3835
+ * Used to indicate that the outlet is able to bind data from the `Router` to the outlet
3836
+ * component's inputs.
3837
+ *
3838
+ * When this is `undefined` or `false` and the developer has opted in to the
3839
+ * feature using `withComponentInputBinding`, a warning will be logged in dev mode if this outlet
3840
+ * is used in the application.
3841
+ */
3842
+ readonly supportsBindingToComponentInputs?: true;
3781
3843
  }
3782
3844
 
3783
3845
  /**
@@ -4349,6 +4411,28 @@ export declare class UrlTree {
4349
4411
  */
4350
4412
  export declare const VERSION: Version;
4351
4413
 
4414
+ /**
4415
+ * Enables binding information from the `Router` state directly to the inputs of the component in
4416
+ * `Route` configurations.
4417
+ *
4418
+ * @usageNotes
4419
+ *
4420
+ * Basic example of how you can enable the feature:
4421
+ * ```
4422
+ * const appRoutes: Routes = [];
4423
+ * bootstrapApplication(AppComponent,
4424
+ * {
4425
+ * providers: [
4426
+ * provideRouter(appRoutes, withComponentInputBinding())
4427
+ * ]
4428
+ * }
4429
+ * );
4430
+ * ```
4431
+ *
4432
+ * @returns A set of providers for use with `provideRouter`.
4433
+ */
4434
+ export declare function withComponentInputBinding(): ComponentInputBindingFeature;
4435
+
4352
4436
  /**
4353
4437
  * Enables logging of all internal navigation events to the console.
4354
4438
  * Extra logging might be useful for debugging purposes to inspect Router event sequence.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular/router",
3
- "version": "16.0.0-next.5",
3
+ "version": "16.0.0-next.6",
4
4
  "description": "Angular - the routing library",
5
5
  "keywords": [
6
6
  "angular",
@@ -24,9 +24,9 @@
24
24
  "tslib": "^2.3.0"
25
25
  },
26
26
  "peerDependencies": {
27
- "@angular/core": "16.0.0-next.5",
28
- "@angular/common": "16.0.0-next.5",
29
- "@angular/platform-browser": "16.0.0-next.5",
27
+ "@angular/core": "16.0.0-next.6",
28
+ "@angular/common": "16.0.0-next.6",
29
+ "@angular/platform-browser": "16.0.0-next.6",
30
30
  "rxjs": "^6.5.3 || ^7.4.0"
31
31
  },
32
32
  "ng-update": {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v16.0.0-next.5
2
+ * @license Angular v16.0.0-next.6
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v16.0.0-next.5
2
+ * @license Angular v16.0.0-next.6
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */