@angular/core 16.0.0-next.2 → 16.0.0-next.3

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.
Files changed (51) hide show
  1. package/esm2020/src/application_ref.mjs +95 -87
  2. package/esm2020/src/application_tokens.mjs +27 -21
  3. package/esm2020/src/compiler/compiler_facade_interface.mjs +1 -1
  4. package/esm2020/src/core_private_export.mjs +2 -3
  5. package/esm2020/src/di/contextual.mjs +37 -0
  6. package/esm2020/src/di/index.mjs +2 -1
  7. package/esm2020/src/di/r3_injector.mjs +1 -1
  8. package/esm2020/src/errors.mjs +1 -1
  9. package/esm2020/src/hydration/annotate.mjs +136 -5
  10. package/esm2020/src/hydration/api.mjs +9 -1
  11. package/esm2020/src/hydration/cleanup.mjs +50 -0
  12. package/esm2020/src/hydration/error_handling.mjs +11 -3
  13. package/esm2020/src/hydration/interfaces.mjs +9 -2
  14. package/esm2020/src/hydration/node_lookup_utils.mjs +22 -14
  15. package/esm2020/src/hydration/skip_hydration.mjs +16 -1
  16. package/esm2020/src/hydration/utils.mjs +82 -7
  17. package/esm2020/src/hydration/views.mjs +80 -0
  18. package/esm2020/src/linker/template_ref.mjs +17 -2
  19. package/esm2020/src/linker/view_container_ref.mjs +110 -35
  20. package/esm2020/src/render3/component_ref.mjs +2 -2
  21. package/esm2020/src/render3/definition.mjs +114 -45
  22. package/esm2020/src/render3/instructions/element.mjs +18 -8
  23. package/esm2020/src/render3/instructions/element_container.mjs +12 -13
  24. package/esm2020/src/render3/instructions/shared.mjs +53 -16
  25. package/esm2020/src/render3/instructions/template.mjs +57 -6
  26. package/esm2020/src/render3/instructions/text.mjs +1 -1
  27. package/esm2020/src/render3/interfaces/container.mjs +3 -2
  28. package/esm2020/src/render3/interfaces/type_checks.mjs +2 -2
  29. package/esm2020/src/render3/interfaces/view.mjs +1 -1
  30. package/esm2020/src/render3/jit/module.mjs +3 -2
  31. package/esm2020/src/render3/ng_module_ref.mjs +9 -5
  32. package/esm2020/src/render3/util/discovery_utils.mjs +3 -2
  33. package/esm2020/src/util/ng_dev_mode.mjs +2 -1
  34. package/esm2020/src/version.mjs +1 -1
  35. package/esm2020/src/zone/ng_zone.mjs +62 -1
  36. package/esm2020/testing/src/logger.mjs +3 -3
  37. package/esm2020/testing/src/ng_zone_mock.mjs +3 -3
  38. package/esm2020/testing/src/test_bed_compiler.mjs +4 -4
  39. package/fesm2015/core.mjs +2354 -1657
  40. package/fesm2015/core.mjs.map +1 -1
  41. package/fesm2015/testing.mjs +1910 -1415
  42. package/fesm2015/testing.mjs.map +1 -1
  43. package/fesm2020/core.mjs +2288 -1581
  44. package/fesm2020/core.mjs.map +1 -1
  45. package/fesm2020/testing.mjs +5085 -4581
  46. package/fesm2020/testing.mjs.map +1 -1
  47. package/index.d.ts +370 -400
  48. package/package.json +1 -1
  49. package/schematics/ng-generate/standalone-migration/bundle.js +198 -99
  50. package/schematics/ng-generate/standalone-migration/bundle.js.map +3 -3
  51. package/testing/index.d.ts +1 -1
package/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v16.0.0-next.2
2
+ * @license Angular v16.0.0-next.3
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -187,13 +187,32 @@ export declare const ANIMATION_MODULE_TYPE: InjectionToken<"NoopAnimations" | "B
187
187
  export declare const APP_BOOTSTRAP_LISTENER: InjectionToken<((compRef: ComponentRef<any>) => void)[]>;
188
188
 
189
189
  /**
190
- * A [DI token](guide/glossary#di-token "DI token definition") representing a unique string ID, used
190
+ * A [DI token](guide/glossary#di-token "DI token definition") representing a string ID, used
191
191
  * primarily for prefixing application attributes and CSS styles when
192
192
  * {@link ViewEncapsulation#Emulated ViewEncapsulation.Emulated} is being used.
193
193
  *
194
- * BY default, the value is randomly generated and assigned to the application by Angular.
195
- * To provide a custom ID value, use a DI provider <!-- TODO: provider --> to configure
196
- * the root {@link Injector} that uses this token.
194
+ * The token is needed in cases when multiple applications are bootstrapped on a page
195
+ * (for example, using `bootstrapApplication` calls). In this case, ensure that those applications
196
+ * have different `APP_ID` value setup. For example:
197
+ *
198
+ * ```
199
+ * bootstrapApplication(ComponentA, {
200
+ * providers: [
201
+ * { provide: APP_ID, useValue: 'app-a' },
202
+ * // ... other providers ...
203
+ * ]
204
+ * });
205
+ *
206
+ * bootstrapApplication(ComponentB, {
207
+ * providers: [
208
+ * { provide: APP_ID, useValue: 'app-b' },
209
+ * // ... other providers ...
210
+ * ]
211
+ * });
212
+ * ```
213
+ *
214
+ * By default, when there is only one application bootstrapped, you don't need to provide the
215
+ * `APP_ID` token (the `ng` will be used as an app ID).
197
216
  *
198
217
  * @publicApi
199
218
  */
@@ -271,8 +290,6 @@ export declare const APP_ID: InjectionToken<string>;
271
290
  */
272
291
  export declare const APP_INITIALIZER: InjectionToken<readonly (() => Observable<unknown> | Promise<unknown> | void)[]>;
273
292
 
274
- declare function _appIdRandomProviderFactory(): string;
275
-
276
293
  /**
277
294
  * Set of config options available during the application bootstrap operation.
278
295
  *
@@ -319,7 +336,6 @@ export declare class ApplicationModule {
319
336
  * A reference to an Angular application running on a page.
320
337
  *
321
338
  * @usageNotes
322
- *
323
339
  * {@a is-stable-examples}
324
340
  * ### isStable examples and caveats
325
341
  *
@@ -409,14 +425,10 @@ export declare class ApplicationModule {
409
425
  * @publicApi
410
426
  */
411
427
  export declare class ApplicationRef {
412
- private _zone;
413
- private _injector;
414
- private _exceptionHandler;
415
428
  private _runningTick;
416
- private _stable;
417
- private _onMicrotaskEmptySubscription;
418
429
  private _destroyed;
419
430
  private _destroyListeners;
431
+ private readonly internalErrorHandler;
420
432
  /**
421
433
  * Indicates whether this instance was destroyed.
422
434
  */
@@ -432,10 +444,9 @@ export declare class ApplicationRef {
432
444
  readonly components: ComponentRef<any>[];
433
445
  /**
434
446
  * Returns an Observable that indicates when the application is stable or unstable.
435
- *
436
- * @see [Usage notes](#is-stable-examples) for examples and caveats when using this API.
437
447
  */
438
448
  readonly isStable: Observable<boolean>;
449
+ private readonly _injector;
439
450
  /**
440
451
  * The `EnvironmentInjector` used to create this application.
441
452
  */
@@ -1245,6 +1256,101 @@ declare interface ComponentDefFeature {
1245
1256
  ngInherit?: true;
1246
1257
  }
1247
1258
 
1259
+ declare interface ComponentDefinition<T> extends Omit<DirectiveDefinition<T>, 'features'> {
1260
+ /**
1261
+ * The number of nodes, local refs, and pipes in this component template.
1262
+ *
1263
+ * Used to calculate the length of this component's LView array, so we
1264
+ * can pre-fill the array and set the binding start index.
1265
+ */
1266
+ decls: number;
1267
+ /**
1268
+ * The number of bindings in this component template (including pure fn bindings).
1269
+ *
1270
+ * Used to calculate the length of this component's LView array, so we
1271
+ * can pre-fill the array and set the host binding start index.
1272
+ */
1273
+ vars: number;
1274
+ /**
1275
+ * Template function use for rendering DOM.
1276
+ *
1277
+ * This function has following structure.
1278
+ *
1279
+ * ```
1280
+ * function Template<T>(ctx:T, creationMode: boolean) {
1281
+ * if (creationMode) {
1282
+ * // Contains creation mode instructions.
1283
+ * }
1284
+ * // Contains binding update instructions
1285
+ * }
1286
+ * ```
1287
+ *
1288
+ * Common instructions are:
1289
+ * Creation mode instructions:
1290
+ * - `elementStart`, `elementEnd`
1291
+ * - `text`
1292
+ * - `container`
1293
+ * - `listener`
1294
+ *
1295
+ * Binding update instructions:
1296
+ * - `bind`
1297
+ * - `elementAttribute`
1298
+ * - `elementProperty`
1299
+ * - `elementClass`
1300
+ * - `elementStyle`
1301
+ *
1302
+ */
1303
+ template: ComponentTemplate<T>;
1304
+ /**
1305
+ * Constants for the nodes in the component's view.
1306
+ * Includes attribute arrays, local definition arrays etc.
1307
+ */
1308
+ consts?: TConstantsOrFactory;
1309
+ /**
1310
+ * An array of `ngContent[selector]` values that were found in the template.
1311
+ */
1312
+ ngContentSelectors?: string[];
1313
+ /**
1314
+ * A list of optional features to apply.
1315
+ *
1316
+ * See: {@link NgOnChangesFeature}, {@link ProvidersFeature}
1317
+ */
1318
+ features?: ComponentDefFeature[];
1319
+ /**
1320
+ * Defines template and style encapsulation options available for Component's {@link Component}.
1321
+ */
1322
+ encapsulation?: ViewEncapsulation;
1323
+ /**
1324
+ * Defines arbitrary developer-defined data to be stored on a renderer instance.
1325
+ * This is useful for renderers that delegate to other renderers.
1326
+ *
1327
+ * see: animation
1328
+ */
1329
+ data?: {
1330
+ [kind: string]: any;
1331
+ };
1332
+ /**
1333
+ * A set of styles that the component needs to be present for component to render correctly.
1334
+ */
1335
+ styles?: string[];
1336
+ /**
1337
+ * The strategy that the default change detector uses to detect changes.
1338
+ * When set, takes effect the next time change detection is triggered.
1339
+ */
1340
+ changeDetection?: ChangeDetectionStrategy;
1341
+ /**
1342
+ * Registry of directives, components, and pipes that may be found in this component's view.
1343
+ *
1344
+ * This property is either an array of types or a function that returns the array of types. This
1345
+ * function may be necessary to support forward declarations.
1346
+ */
1347
+ dependencies?: TypeOrFactory<DependencyTypeList>;
1348
+ /**
1349
+ * The set of schemas that declare elements to be allowed in the component's template.
1350
+ */
1351
+ schemas?: SchemaMetadata[] | null;
1352
+ }
1353
+
1248
1354
  /**
1249
1355
  * Base class for a factory that can create a component dynamically.
1250
1356
  * Instantiate a factory for a given type of component with `resolveComponentFactory()`.
@@ -1554,6 +1660,8 @@ declare type ConsumerId = number & {
1554
1660
  __consumer: true;
1555
1661
  };
1556
1662
 
1663
+ declare const CONTAINERS = "c";
1664
+
1557
1665
  /**
1558
1666
  * Type of the ContentChild metadata.
1559
1667
  *
@@ -2184,17 +2292,17 @@ export declare class DefaultIterableDiffer<V> implements IterableDiffer<V>, Iter
2184
2292
  */
2185
2293
  export declare const defineInjectable: typeof ɵɵdefineInjectable;
2186
2294
 
2295
+ declare const DEHYDRATED_VIEWS = 10;
2296
+
2187
2297
  /**
2188
- * Represents a hydration-related element container structure
2189
- * at runtime, which includes a reference to a first node in
2190
- * a DOM segment that corresponds to a given element container.
2298
+ * An object that contains hydration-related information serialized
2299
+ * on the server, as well as the necessary references to segments of
2300
+ * the DOM, to facilitate the hydration process for a given view
2301
+ * inside a view container (either an embedded view or a view created
2302
+ * for a component).
2191
2303
  */
2192
- declare interface DehydratedElementContainer {
2193
- /**
2194
- * A reference to the first child in a DOM segment associated
2195
- * with a first child in a given <ng-container>.
2196
- */
2197
- firstChild: RNode | null;
2304
+ declare interface DehydratedContainerView extends DehydratedView {
2305
+ data: Readonly<SerializedContainerView>;
2198
2306
  }
2199
2307
 
2200
2308
  /**
@@ -2214,13 +2322,11 @@ declare interface DehydratedView {
2214
2322
  */
2215
2323
  firstChild: RNode | null;
2216
2324
  /**
2217
- * Collection of <ng-container>s in a given view,
2218
- * used as a set of pointers to first children in each
2219
- * <ng-container>, so that those pointers are reused by
2220
- * subsequent instructions.
2325
+ * Stores references to first nodes in DOM segments that
2326
+ * represent either an <ng-container> or a view container.
2221
2327
  */
2222
- ngContainers?: {
2223
- [index: number]: DehydratedElementContainer;
2328
+ segmentHeads?: {
2329
+ [index: number]: RNode | null;
2224
2330
  };
2225
2331
  }
2226
2332
 
@@ -2612,6 +2718,141 @@ declare interface DirectiveDefFeature {
2612
2718
  ngInherit?: true;
2613
2719
  }
2614
2720
 
2721
+ declare interface DirectiveDefinition<T> {
2722
+ /**
2723
+ * Directive type, needed to configure the injector.
2724
+ */
2725
+ type: Type<T>;
2726
+ /** The selectors that will be used to match nodes to this directive. */
2727
+ selectors?: ɵCssSelectorList;
2728
+ /**
2729
+ * A map of input names.
2730
+ *
2731
+ * The format is in: `{[actualPropertyName: string]:(string|[string, string])}`.
2732
+ *
2733
+ * Given:
2734
+ * ```
2735
+ * class MyComponent {
2736
+ * @Input()
2737
+ * publicInput1: string;
2738
+ *
2739
+ * @Input('publicInput2')
2740
+ * declaredInput2: string;
2741
+ * }
2742
+ * ```
2743
+ *
2744
+ * is described as:
2745
+ * ```
2746
+ * {
2747
+ * publicInput1: 'publicInput1',
2748
+ * declaredInput2: ['declaredInput2', 'publicInput2'],
2749
+ * }
2750
+ * ```
2751
+ *
2752
+ * Which the minifier may translate to:
2753
+ * ```
2754
+ * {
2755
+ * minifiedPublicInput1: 'publicInput1',
2756
+ * minifiedDeclaredInput2: [ 'publicInput2', 'declaredInput2'],
2757
+ * }
2758
+ * ```
2759
+ *
2760
+ * This allows the render to re-construct the minified, public, and declared names
2761
+ * of properties.
2762
+ *
2763
+ * NOTE:
2764
+ * - Because declared and public name are usually same we only generate the array
2765
+ * `['declared', 'public']` format when they differ.
2766
+ * - The reason why this API and `outputs` API is not the same is that `NgOnChanges` has
2767
+ * inconsistent behavior in that it uses declared names rather than minified or public. For
2768
+ * this reason `NgOnChanges` will be deprecated and removed in future version and this
2769
+ * API will be simplified to be consistent with `output`.
2770
+ */
2771
+ inputs?: {
2772
+ [P in keyof T]?: string | [string, string];
2773
+ };
2774
+ /**
2775
+ * A map of output names.
2776
+ *
2777
+ * The format is in: `{[actualPropertyName: string]:string}`.
2778
+ *
2779
+ * Which the minifier may translate to: `{[minifiedPropertyName: string]:string}`.
2780
+ *
2781
+ * This allows the render to re-construct the minified and non-minified names
2782
+ * of properties.
2783
+ */
2784
+ outputs?: {
2785
+ [P in keyof T]?: string;
2786
+ };
2787
+ /**
2788
+ * A list of optional features to apply.
2789
+ *
2790
+ * See: {@link NgOnChangesFeature}, {@link ProvidersFeature}, {@link InheritDefinitionFeature}
2791
+ */
2792
+ features?: DirectiveDefFeature[];
2793
+ /**
2794
+ * Function executed by the parent template to allow child directive to apply host bindings.
2795
+ */
2796
+ hostBindings?: HostBindingsFunction<T>;
2797
+ /**
2798
+ * The number of bindings in this directive `hostBindings` (including pure fn bindings).
2799
+ *
2800
+ * Used to calculate the length of the component's LView array, so we
2801
+ * can pre-fill the array and set the host binding start index.
2802
+ */
2803
+ hostVars?: number;
2804
+ /**
2805
+ * Assign static attribute values to a host element.
2806
+ *
2807
+ * This property will assign static attribute values as well as class and style
2808
+ * values to a host element. Since attribute values can consist of different types of values,
2809
+ * the `hostAttrs` array must include the values in the following format:
2810
+ *
2811
+ * attrs = [
2812
+ * // static attributes (like `title`, `name`, `id`...)
2813
+ * attr1, value1, attr2, value,
2814
+ *
2815
+ * // a single namespace value (like `x:id`)
2816
+ * NAMESPACE_MARKER, namespaceUri1, name1, value1,
2817
+ *
2818
+ * // another single namespace value (like `x:name`)
2819
+ * NAMESPACE_MARKER, namespaceUri2, name2, value2,
2820
+ *
2821
+ * // a series of CSS classes that will be applied to the element (no spaces)
2822
+ * CLASSES_MARKER, class1, class2, class3,
2823
+ *
2824
+ * // a series of CSS styles (property + value) that will be applied to the element
2825
+ * STYLES_MARKER, prop1, value1, prop2, value2
2826
+ * ]
2827
+ *
2828
+ * All non-class and non-style attributes must be defined at the start of the list
2829
+ * first before all class and style values are set. When there is a change in value
2830
+ * type (like when classes and styles are introduced) a marker must be used to separate
2831
+ * the entries. The marker values themselves are set via entries found in the
2832
+ * [AttributeMarker] enum.
2833
+ */
2834
+ hostAttrs?: TAttributes;
2835
+ /**
2836
+ * Function to create instances of content queries associated with a given directive.
2837
+ */
2838
+ contentQueries?: ContentQueriesFunction<T>;
2839
+ /**
2840
+ * Additional set of instructions specific to view query processing. This could be seen as a
2841
+ * set of instructions to be inserted into the template function.
2842
+ */
2843
+ viewQuery?: ViewQueriesFunction<T> | null;
2844
+ /**
2845
+ * Defines the name that can be used in the template to assign this directive to a variable.
2846
+ *
2847
+ * See: {@link Directive.exportAs}
2848
+ */
2849
+ exportAs?: string[];
2850
+ /**
2851
+ * Whether this directive/component is standalone.
2852
+ */
2853
+ standalone?: boolean;
2854
+ }
2855
+
2615
2856
  declare type DirectiveDefList = (ɵDirectiveDef<any> | ɵComponentDef<any>)[];
2616
2857
 
2617
2858
  /**
@@ -2741,6 +2982,10 @@ export declare interface Effect {
2741
2982
  */
2742
2983
  export declare function effect(effectFn: () => void): Effect;
2743
2984
 
2985
+ /**
2986
+ * Keys within serialized view data structure to represent various
2987
+ * parts. See the `SerializedView` interface below for additional information.
2988
+ */
2744
2989
  declare const ELEMENT_CONTAINERS = "e";
2745
2990
 
2746
2991
  /**
@@ -2928,6 +3173,7 @@ export declare abstract class EnvironmentInjector implements Injector {
2928
3173
  *
2929
3174
  * @param fn the closure to be run in the context of this injector
2930
3175
  * @returns the return value of the function, if any
3176
+ * @deprecated use the standalone function `runInInjectionContext` instead
2931
3177
  */
2932
3178
  abstract runInContext<ReturnT>(fn: () => ReturnT): ReturnT;
2933
3179
  abstract destroy(): void;
@@ -4808,7 +5054,7 @@ declare interface LContainer extends Array<any> {
4808
5054
  */
4809
5055
  [T_HOST]: TNode;
4810
5056
  /** The comment element that serves as an anchor for this LContainer. */
4811
- readonly [NATIVE]: RComment;
5057
+ [NATIVE]: RComment;
4812
5058
  /**
4813
5059
  * Array of `ViewRef`s used by any `ViewContainerRef`s that point to this container.
4814
5060
  *
@@ -4818,8 +5064,19 @@ declare interface LContainer extends Array<any> {
4818
5064
  * doing so creates circular dependency.
4819
5065
  */
4820
5066
  [VIEW_REFS]: unknown[] | null;
4821
- }
4822
-
5067
+ /**
5068
+ * Array of dehydrated views within this container.
5069
+ *
5070
+ * This information is used during the hydration process on the client.
5071
+ * The hydration logic tries to find a matching dehydrated view, "claim" it
5072
+ * and use this information to do further matching. After that, this "claimed"
5073
+ * view is removed from the list. The remaining "unclaimed" views are
5074
+ * "garbage-collected" later on, i.e. removed from the DOM once the hydration
5075
+ * logic finishes.
5076
+ */
5077
+ [DEHYDRATED_VIEWS]: DehydratedContainerView[] | null;
5078
+ }
5079
+
4823
5080
  /**
4824
5081
  * Provide this token to set the locale of your application.
4825
5082
  * It is used for i18n extraction, by i18n pipes (DatePipe, I18nPluralPipe, CurrencyPipe,
@@ -5281,6 +5538,12 @@ export declare interface ModuleWithProviders<T> {
5281
5538
 
5282
5539
  declare const MOVED_VIEWS = 9;
5283
5540
 
5541
+ declare type Mutable<T extends {
5542
+ [x: string]: any;
5543
+ }, K extends string> = {
5544
+ [P in K]: T[P];
5545
+ };
5546
+
5284
5547
  declare const NATIVE = 7;
5285
5548
 
5286
5549
  declare const NEXT = 4;
@@ -5731,6 +5994,8 @@ export declare class NgZone {
5731
5994
  */
5732
5995
  export declare const NO_ERRORS_SCHEMA: SchemaMetadata;
5733
5996
 
5997
+ declare const NUM_ROOT_NODES = "r";
5998
+
5734
5999
  declare const ON_DESTROY_HOOKS = 22;
5735
6000
 
5736
6001
  /**
@@ -6633,7 +6898,7 @@ declare class R3Injector extends EnvironmentInjector {
6633
6898
  runInContext<ReturnT>(fn: () => ReturnT): ReturnT;
6634
6899
  get<T>(token: ProviderToken<T>, notFoundValue?: any, flags?: InjectFlags | InjectOptions): T;
6635
6900
  toString(): string;
6636
- private assertNotDestroyed;
6901
+ assertNotDestroyed(): void;
6637
6902
  /**
6638
6903
  * Process a `SingleProvider` and add it.
6639
6904
  */
@@ -7418,6 +7683,20 @@ declare interface RText extends RNode {
7418
7683
  textContent: string | null;
7419
7684
  }
7420
7685
 
7686
+ /**
7687
+ * Runs the given function in the context of the given `Injector`.
7688
+ *
7689
+ * Within the function's stack frame, `inject` can be used to inject dependencies from the given
7690
+ * `Injector`. Note that `inject` is only usable synchronously, and cannot be used in any
7691
+ * asynchronous callbacks or after any `await` points.
7692
+ *
7693
+ * @param injector the injector which will satisfy calls to `inject` while `fn` is executing
7694
+ * @param fn the closure to be run in the context of `injector`
7695
+ * @returns the return value of the function, if any
7696
+ * @publicApi
7697
+ */
7698
+ export declare function runInInjectionContext<ReturnT>(injector: Injector, fn: () => ReturnT): ReturnT;
7699
+
7421
7700
 
7422
7701
  /**
7423
7702
  * The list of error codes used in runtime code of the `core` package.
@@ -7456,7 +7735,7 @@ declare const enum RuntimeErrorCode {
7456
7735
  HOST_DIRECTIVE_CONFLICTING_ALIAS = 312,
7457
7736
  MULTIPLE_PLATFORMS = 400,
7458
7737
  PLATFORM_NOT_FOUND = 401,
7459
- ERROR_HANDLER_NOT_FOUND = 402,
7738
+ MISSING_REQUIRED_INJECTABLE_IN_BOOTSTRAP = 402,
7460
7739
  BOOTSTRAP_COMPONENTS_NOT_FOUND = -403,
7461
7740
  PLATFORM_ALREADY_DESTROYED = 404,
7462
7741
  ASYNC_INITIALIZERS_STILL_RUNNING = 405,
@@ -7587,6 +7866,28 @@ export declare interface SelfDecorator {
7587
7866
  new (): Self;
7588
7867
  }
7589
7868
 
7869
+ /**
7870
+ * Serialized data structure that contains relevant hydration
7871
+ * annotation information about a view that is a part of a
7872
+ * ViewContainer collection.
7873
+ */
7874
+ declare interface SerializedContainerView extends SerializedView {
7875
+ /**
7876
+ * Unique id that represents a TView that was used to create
7877
+ * a given instance of a view:
7878
+ * - TViewType.Embedded: a unique id generated during serialization on the server
7879
+ * - TViewType.Component: an id generated based on component properties
7880
+ * (see `getComponentId` function for details)
7881
+ */
7882
+ [TEMPLATE_ID]: string;
7883
+ /**
7884
+ * Number of root nodes that belong to this view.
7885
+ * This information is needed to effectively traverse the DOM tree
7886
+ * and identify segments that belong to different views.
7887
+ */
7888
+ [NUM_ROOT_NODES]: number;
7889
+ }
7890
+
7590
7891
  /**
7591
7892
  * Represents element containers within this view, stored as key-value pairs
7592
7893
  * where key is an index of a container in an LView (also used in the
@@ -7608,6 +7909,20 @@ declare interface SerializedView {
7608
7909
  * Serialized information about <ng-container>s.
7609
7910
  */
7610
7911
  [ELEMENT_CONTAINERS]?: SerializedElementContainers;
7912
+ /**
7913
+ * Serialized information about templates.
7914
+ * Key-value pairs where a key is an index of the corresponding
7915
+ * `template` instruction and the value is a unique id that can
7916
+ * be used during hydration to identify that template.
7917
+ */
7918
+ [TEMPLATES]?: Record<number, string>;
7919
+ /**
7920
+ * Serialized information about view containers.
7921
+ * Key-value pairs where a key is an index of the corresponding
7922
+ * LContainer entry within an LView, and the value is a list
7923
+ * of serialized information about views within this container.
7924
+ */
7925
+ [CONTAINERS]?: Record<number, SerializedContainerView[]>;
7611
7926
  }
7612
7927
 
7613
7928
  /**
@@ -7922,6 +8237,8 @@ declare interface TElementNode extends TNode {
7922
8237
  value: string;
7923
8238
  }
7924
8239
 
8240
+ declare const TEMPLATE_ID = "i";
8241
+
7925
8242
  /**
7926
8243
  * Represents an embedded template that can be used to instantiate embedded views.
7927
8244
  * To instantiate embedded views based on a template, use the `ViewContainerRef`
@@ -7963,6 +8280,8 @@ export declare abstract class TemplateRef<C> {
7963
8280
  abstract createEmbeddedView(context: C, injector?: Injector): EmbeddedViewRef<C>;
7964
8281
  }
7965
8282
 
8283
+ declare const TEMPLATES = "t";
8284
+
7966
8285
  /**
7967
8286
  * The Testability service provides testing hooks that can be accessed from
7968
8287
  * the browser.
@@ -9277,6 +9596,13 @@ declare interface TView {
9277
9596
  * view. This means that the view is likely corrupted and we should try to recover it.
9278
9597
  */
9279
9598
  incompleteFirstPass: boolean;
9599
+ /**
9600
+ * Unique id of this TView for hydration purposes:
9601
+ * - TViewType.Embedded: a unique id generated during serialization on the server
9602
+ * - TViewType.Component: an id generated based on component properties
9603
+ * (see `getComponentId` function for details)
9604
+ */
9605
+ ssrId: string | null;
9280
9606
  }
9281
9607
 
9282
9608
  /**
@@ -9906,16 +10232,6 @@ export declare function ɵallowSanitizationBypassAndThrow(value: any, type: ɵBy
9906
10232
  */
9907
10233
  export declare function ɵannotateForHydration(appRef: ApplicationRef, doc: Document): void;
9908
10234
 
9909
- /**
9910
- * Providers that generate a random `APP_ID_TOKEN`.
9911
- * @publicApi
9912
- */
9913
- export declare const ɵAPP_ID_RANDOM_PROVIDER: {
9914
- provide: InjectionToken<string>;
9915
- useFactory: typeof _appIdRandomProviderFactory;
9916
- deps: any[];
9917
- };
9918
-
9919
10235
  /**
9920
10236
  * A set of marker values to be used in the attributes arrays. These markers indicate that some
9921
10237
  * items are not regular attributes and the processing should be adapted accordingly.
@@ -10896,9 +11212,9 @@ export declare const ɵNO_CHANGE: ɵNO_CHANGE;
10896
11212
  * to framework to perform rendering.
10897
11213
  */
10898
11214
  export declare class ɵNoopNgZone implements NgZone {
10899
- readonly hasPendingMicrotasks: boolean;
10900
- readonly hasPendingMacrotasks: boolean;
10901
- readonly isStable: boolean;
11215
+ readonly hasPendingMicrotasks = false;
11216
+ readonly hasPendingMacrotasks = false;
11217
+ readonly isStable = true;
10902
11218
  readonly onUnstable: EventEmitter<any>;
10903
11219
  readonly onMicrotaskEmpty: EventEmitter<any>;
10904
11220
  readonly onStable: EventEmitter<any>;
@@ -11069,6 +11385,8 @@ export declare const enum ɵProfilerEvent {
11069
11385
  */
11070
11386
  export declare function ɵprovideHydrationSupport(): EnvironmentProviders;
11071
11387
 
11388
+ export declare function ɵprovideNgZoneChangeDetection(ngZone: NgZone): StaticProvider[];
11389
+
11072
11390
  /**
11073
11391
  * Publishes a collection of default debug tools onto`window.ng`.
11074
11392
  *
@@ -11166,7 +11484,7 @@ export declare class ɵRender3NgModuleRef<T> extends NgModuleRef<T> implements I
11166
11484
  instance: T;
11167
11485
  destroyCbs: (() => void)[] | null;
11168
11486
  readonly componentFactoryResolver: ComponentFactoryResolver_2;
11169
- constructor(ngModuleType: Type<T>, _parent: Injector | null);
11487
+ constructor(ngModuleType: Type<T>, _parent: Injector | null, additionalProviders: StaticProvider[]);
11170
11488
  get injector(): EnvironmentInjector;
11171
11489
  destroy(): void;
11172
11490
  onDestroy(callback: () => void): void;
@@ -12372,7 +12690,7 @@ export declare function ɵɵCopyDefinitionFeature(definition: ɵDirectiveDef<any
12372
12690
  *
12373
12691
  * # Example
12374
12692
  * ```
12375
- * class MyDirective {
12693
+ * class MyComponent {
12376
12694
  * // Generated by Angular Template Compiler
12377
12695
  * // [Symbol] syntax will not be supported by TypeScript until v2.7
12378
12696
  * static ɵcmp = defineComponent({
@@ -12382,230 +12700,7 @@ export declare function ɵɵCopyDefinitionFeature(definition: ɵDirectiveDef<any
12382
12700
  * ```
12383
12701
  * @codeGenApi
12384
12702
  */
12385
- export declare function ɵɵdefineComponent<T>(componentDefinition: {
12386
- /**
12387
- * Directive type, needed to configure the injector.
12388
- */
12389
- type: Type<T>;
12390
- /** The selectors that will be used to match nodes to this component. */
12391
- selectors?: ɵCssSelectorList;
12392
- /**
12393
- * The number of nodes, local refs, and pipes in this component template.
12394
- *
12395
- * Used to calculate the length of this component's LView array, so we
12396
- * can pre-fill the array and set the binding start index.
12397
- */
12398
- decls: number;
12399
- /**
12400
- * The number of bindings in this component template (including pure fn bindings).
12401
- *
12402
- * Used to calculate the length of this component's LView array, so we
12403
- * can pre-fill the array and set the host binding start index.
12404
- */
12405
- vars: number;
12406
- /**
12407
- * A map of input names.
12408
- *
12409
- * The format is in: `{[actualPropertyName: string]:(string|[string, string])}`.
12410
- *
12411
- * Given:
12412
- * ```
12413
- * class MyComponent {
12414
- * @Input()
12415
- * publicInput1: string;
12416
- *
12417
- * @Input('publicInput2')
12418
- * declaredInput2: string;
12419
- * }
12420
- * ```
12421
- *
12422
- * is described as:
12423
- * ```
12424
- * {
12425
- * publicInput1: 'publicInput1',
12426
- * declaredInput2: ['publicInput2', 'declaredInput2'],
12427
- * }
12428
- * ```
12429
- *
12430
- * Which the minifier may translate to:
12431
- * ```
12432
- * {
12433
- * minifiedPublicInput1: 'publicInput1',
12434
- * minifiedDeclaredInput2: ['publicInput2', 'declaredInput2'],
12435
- * }
12436
- * ```
12437
- *
12438
- * This allows the render to re-construct the minified, public, and declared names
12439
- * of properties.
12440
- *
12441
- * NOTE:
12442
- * - Because declared and public name are usually same we only generate the array
12443
- * `['public', 'declared']` format when they differ.
12444
- * - The reason why this API and `outputs` API is not the same is that `NgOnChanges` has
12445
- * inconsistent behavior in that it uses declared names rather than minified or public. For
12446
- * this reason `NgOnChanges` will be deprecated and removed in future version and this
12447
- * API will be simplified to be consistent with `output`.
12448
- */
12449
- inputs?: {
12450
- [P in keyof T]?: string | [string, string];
12451
- };
12452
- /**
12453
- * A map of output names.
12454
- *
12455
- * The format is in: `{[actualPropertyName: string]:string}`.
12456
- *
12457
- * Which the minifier may translate to: `{[minifiedPropertyName: string]:string}`.
12458
- *
12459
- * This allows the render to re-construct the minified and non-minified names
12460
- * of properties.
12461
- */
12462
- outputs?: {
12463
- [P in keyof T]?: string;
12464
- };
12465
- /**
12466
- * Function executed by the parent template to allow child directive to apply host bindings.
12467
- */
12468
- hostBindings?: HostBindingsFunction<T>;
12469
- /**
12470
- * The number of bindings in this directive `hostBindings` (including pure fn bindings).
12471
- *
12472
- * Used to calculate the length of the component's LView array, so we
12473
- * can pre-fill the array and set the host binding start index.
12474
- */
12475
- hostVars?: number;
12476
- /**
12477
- * Assign static attribute values to a host element.
12478
- *
12479
- * This property will assign static attribute values as well as class and style
12480
- * values to a host element. Since attribute values can consist of different types of values, the
12481
- * `hostAttrs` array must include the values in the following format:
12482
- *
12483
- * attrs = [
12484
- * // static attributes (like `title`, `name`, `id`...)
12485
- * attr1, value1, attr2, value,
12486
- *
12487
- * // a single namespace value (like `x:id`)
12488
- * NAMESPACE_MARKER, namespaceUri1, name1, value1,
12489
- *
12490
- * // another single namespace value (like `x:name`)
12491
- * NAMESPACE_MARKER, namespaceUri2, name2, value2,
12492
- *
12493
- * // a series of CSS classes that will be applied to the element (no spaces)
12494
- * CLASSES_MARKER, class1, class2, class3,
12495
- *
12496
- * // a series of CSS styles (property + value) that will be applied to the element
12497
- * STYLES_MARKER, prop1, value1, prop2, value2
12498
- * ]
12499
- *
12500
- * All non-class and non-style attributes must be defined at the start of the list
12501
- * first before all class and style values are set. When there is a change in value
12502
- * type (like when classes and styles are introduced) a marker must be used to separate
12503
- * the entries. The marker values themselves are set via entries found in the
12504
- * [AttributeMarker] enum.
12505
- */
12506
- hostAttrs?: TAttributes;
12507
- /**
12508
- * Function to create instances of content queries associated with a given directive.
12509
- */
12510
- contentQueries?: ContentQueriesFunction<T>;
12511
- /**
12512
- * Defines the name that can be used in the template to assign this directive to a variable.
12513
- *
12514
- * See: {@link Directive.exportAs}
12515
- */
12516
- exportAs?: string[];
12517
- /**
12518
- * Template function use for rendering DOM.
12519
- *
12520
- * This function has following structure.
12521
- *
12522
- * ```
12523
- * function Template<T>(ctx:T, creationMode: boolean) {
12524
- * if (creationMode) {
12525
- * // Contains creation mode instructions.
12526
- * }
12527
- * // Contains binding update instructions
12528
- * }
12529
- * ```
12530
- *
12531
- * Common instructions are:
12532
- * Creation mode instructions:
12533
- * - `elementStart`, `elementEnd`
12534
- * - `text`
12535
- * - `container`
12536
- * - `listener`
12537
- *
12538
- * Binding update instructions:
12539
- * - `bind`
12540
- * - `elementAttribute`
12541
- * - `elementProperty`
12542
- * - `elementClass`
12543
- * - `elementStyle`
12544
- *
12545
- */
12546
- template: ComponentTemplate<T>;
12547
- /**
12548
- * Constants for the nodes in the component's view.
12549
- * Includes attribute arrays, local definition arrays etc.
12550
- */
12551
- consts?: TConstantsOrFactory;
12552
- /**
12553
- * An array of `ngContent[selector]` values that were found in the template.
12554
- */
12555
- ngContentSelectors?: string[];
12556
- /**
12557
- * Additional set of instructions specific to view query processing. This could be seen as a
12558
- * set of instruction to be inserted into the template function.
12559
- *
12560
- * Query-related instructions need to be pulled out to a specific function as a timing of
12561
- * execution is different as compared to all other instructions (after change detection hooks but
12562
- * before view hooks).
12563
- */
12564
- viewQuery?: ViewQueriesFunction<T> | null;
12565
- /**
12566
- * A list of optional features to apply.
12567
- *
12568
- * See: {@link NgOnChangesFeature}, {@link ProvidersFeature}
12569
- */
12570
- features?: ComponentDefFeature[];
12571
- /**
12572
- * Defines template and style encapsulation options available for Component's {@link Component}.
12573
- */
12574
- encapsulation?: ViewEncapsulation;
12575
- /**
12576
- * Defines arbitrary developer-defined data to be stored on a renderer instance.
12577
- * This is useful for renderers that delegate to other renderers.
12578
- *
12579
- * see: animation
12580
- */
12581
- data?: {
12582
- [kind: string]: any;
12583
- };
12584
- /**
12585
- * A set of styles that the component needs to be present for component to render correctly.
12586
- */
12587
- styles?: string[];
12588
- /**
12589
- * The strategy that the default change detector uses to detect changes.
12590
- * When set, takes effect the next time change detection is triggered.
12591
- */
12592
- changeDetection?: ChangeDetectionStrategy;
12593
- /**
12594
- * Registry of directives, components, and pipes that may be found in this component's view.
12595
- *
12596
- * This property is either an array of types or a function that returns the array of types. This
12597
- * function may be necessary to support forward declarations.
12598
- */
12599
- dependencies?: TypeOrFactory<DependencyTypeList>;
12600
- /**
12601
- * The set of schemas that declare elements to be allowed in the component's template.
12602
- */
12603
- schemas?: SchemaMetadata[] | null;
12604
- /**
12605
- * Whether this directive/component is standalone.
12606
- */
12607
- standalone?: boolean;
12608
- }): unknown;
12703
+ export declare function ɵɵdefineComponent<T>(componentDefinition: ComponentDefinition<T>): Mutable<ɵComponentDef<any>, keyof ɵComponentDef<any>>;
12609
12704
 
12610
12705
  /**
12611
12706
  * Create a directive definition object.
@@ -12623,132 +12718,7 @@ export declare function ɵɵdefineComponent<T>(componentDefinition: {
12623
12718
  *
12624
12719
  * @codeGenApi
12625
12720
  */
12626
- export declare const ɵɵdefineDirective: <T>(directiveDefinition: {
12627
- /**
12628
- * Directive type, needed to configure the injector.
12629
- */
12630
- type: Type<T>;
12631
- /** The selectors that will be used to match nodes to this directive. */
12632
- selectors?: ɵCssSelectorList | undefined;
12633
- /**
12634
- * A map of input names.
12635
- *
12636
- * The format is in: `{[actualPropertyName: string]:(string|[string, string])}`.
12637
- *
12638
- * Given:
12639
- * ```
12640
- * class MyComponent {
12641
- * @Input()
12642
- * publicInput1: string;
12643
- *
12644
- * @Input('publicInput2')
12645
- * declaredInput2: string;
12646
- * }
12647
- * ```
12648
- *
12649
- * is described as:
12650
- * ```
12651
- * {
12652
- * publicInput1: 'publicInput1',
12653
- * declaredInput2: ['declaredInput2', 'publicInput2'],
12654
- * }
12655
- * ```
12656
- *
12657
- * Which the minifier may translate to:
12658
- * ```
12659
- * {
12660
- * minifiedPublicInput1: 'publicInput1',
12661
- * minifiedDeclaredInput2: [ 'publicInput2', 'declaredInput2'],
12662
- * }
12663
- * ```
12664
- *
12665
- * This allows the render to re-construct the minified, public, and declared names
12666
- * of properties.
12667
- *
12668
- * NOTE:
12669
- * - Because declared and public name are usually same we only generate the array
12670
- * `['declared', 'public']` format when they differ.
12671
- * - The reason why this API and `outputs` API is not the same is that `NgOnChanges` has
12672
- * inconsistent behavior in that it uses declared names rather than minified or public. For
12673
- * this reason `NgOnChanges` will be deprecated and removed in future version and this
12674
- * API will be simplified to be consistent with `output`.
12675
- */
12676
- inputs?: { [P in keyof T]?: string | [string, string] | undefined; } | undefined;
12677
- /**
12678
- * A map of output names.
12679
- *
12680
- * The format is in: `{[actualPropertyName: string]:string}`.
12681
- *
12682
- * Which the minifier may translate to: `{[minifiedPropertyName: string]:string}`.
12683
- *
12684
- * This allows the render to re-construct the minified and non-minified names
12685
- * of properties.
12686
- */
12687
- outputs?: { [P_1 in keyof T]?: string | undefined; } | undefined;
12688
- /**
12689
- * A list of optional features to apply.
12690
- *
12691
- * See: {@link NgOnChangesFeature}, {@link ProvidersFeature}, {@link InheritDefinitionFeature}
12692
- */
12693
- features?: DirectiveDefFeature[] | undefined;
12694
- /**
12695
- * Function executed by the parent template to allow child directive to apply host bindings.
12696
- */
12697
- hostBindings?: HostBindingsFunction<T> | undefined;
12698
- /**
12699
- * The number of bindings in this directive `hostBindings` (including pure fn bindings).
12700
- *
12701
- * Used to calculate the length of the component's LView array, so we
12702
- * can pre-fill the array and set the host binding start index.
12703
- */
12704
- hostVars?: number | undefined;
12705
- /**
12706
- * Assign static attribute values to a host element.
12707
- *
12708
- * This property will assign static attribute values as well as class and style
12709
- * values to a host element. Since attribute values can consist of different types of values,
12710
- * the `hostAttrs` array must include the values in the following format:
12711
- *
12712
- * attrs = [
12713
- * // static attributes (like `title`, `name`, `id`...)
12714
- * attr1, value1, attr2, value,
12715
- *
12716
- * // a single namespace value (like `x:id`)
12717
- * NAMESPACE_MARKER, namespaceUri1, name1, value1,
12718
- *
12719
- * // another single namespace value (like `x:name`)
12720
- * NAMESPACE_MARKER, namespaceUri2, name2, value2,
12721
- *
12722
- * // a series of CSS classes that will be applied to the element (no spaces)
12723
- * CLASSES_MARKER, class1, class2, class3,
12724
- *
12725
- * // a series of CSS styles (property + value) that will be applied to the element
12726
- * STYLES_MARKER, prop1, value1, prop2, value2
12727
- * ]
12728
- *
12729
- * All non-class and non-style attributes must be defined at the start of the list
12730
- * first before all class and style values are set. When there is a change in value
12731
- * type (like when classes and styles are introduced) a marker must be used to separate
12732
- * the entries. The marker values themselves are set via entries found in the
12733
- * [AttributeMarker] enum.
12734
- */
12735
- hostAttrs?: TAttributes | undefined;
12736
- /**
12737
- * Function to create instances of content queries associated with a given directive.
12738
- */
12739
- contentQueries?: ContentQueriesFunction<T> | undefined;
12740
- /**
12741
- * Additional set of instructions specific to view query processing. This could be seen as a
12742
- * set of instructions to be inserted into the template function.
12743
- */
12744
- viewQuery?: ViewQueriesFunction<T> | null | undefined;
12745
- /**
12746
- * Defines the name that can be used in the template to assign this directive to a variable.
12747
- *
12748
- * See: {@link Directive.exportAs}
12749
- */
12750
- exportAs?: string[] | undefined;
12751
- }) => never;
12721
+ export declare function ɵɵdefineDirective<T>(directiveDefinition: DirectiveDefinition<T>): Mutable<ɵDirectiveDef<any>, keyof ɵDirectiveDef<any>>;
12752
12722
 
12753
12723
  /**
12754
12724
  * Construct an injectable definition which defines how a token will be constructed by the DI