@angular/core 17.1.0-next.2 → 17.1.0-next.4

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 (69) hide show
  1. package/esm2022/primitives/signals/src/signal.mjs +2 -9
  2. package/esm2022/src/application/application_config.mjs +21 -0
  3. package/esm2022/src/application/application_init.mjs +188 -0
  4. package/esm2022/src/application/application_module.mjs +29 -0
  5. package/esm2022/src/application/application_ref.mjs +509 -0
  6. package/esm2022/src/application/application_tokens.mjs +121 -0
  7. package/esm2022/src/application/create_application.mjs +102 -0
  8. package/esm2022/src/authoring/input.mjs +41 -0
  9. package/esm2022/src/authoring/input_signal.mjs +10 -0
  10. package/esm2022/src/authoring/input_type_checking.mjs +9 -0
  11. package/esm2022/src/authoring.mjs +12 -0
  12. package/esm2022/src/change_detection/scheduling.mjs +103 -0
  13. package/esm2022/src/compiler/compiler_facade_interface.mjs +1 -1
  14. package/esm2022/src/core.mjs +15 -7
  15. package/esm2022/src/core_private_export.mjs +5 -3
  16. package/esm2022/src/core_reactivity_export_internal.mjs +2 -2
  17. package/esm2022/src/core_render3_private_export.mjs +2 -2
  18. package/esm2022/src/error_handler.mjs +15 -1
  19. package/esm2022/src/hydration/annotate.mjs +30 -20
  20. package/esm2022/src/hydration/api.mjs +2 -2
  21. package/esm2022/src/hydration/cleanup.mjs +1 -1
  22. package/esm2022/src/hydration/interfaces.mjs +1 -1
  23. package/esm2022/src/hydration/node_lookup_utils.mjs +23 -2
  24. package/esm2022/src/image_performance_warning.mjs +2 -2
  25. package/esm2022/src/linker/query_list.mjs +8 -6
  26. package/esm2022/src/metadata/do_bootstrap.mjs +1 -1
  27. package/esm2022/src/platform/platform.mjs +135 -0
  28. package/esm2022/src/platform/platform_core_providers.mjs +15 -0
  29. package/esm2022/src/platform/platform_ref.mjs +179 -0
  30. package/esm2022/src/render3/instructions/change_detection.mjs +2 -4
  31. package/esm2022/src/render3/interfaces/definition.mjs +1 -1
  32. package/esm2022/src/render3/interfaces/public_definitions.mjs +1 -1
  33. package/esm2022/src/render3/list_reconciliation.mjs +58 -24
  34. package/esm2022/src/render3/node_manipulation.mjs +2 -2
  35. package/esm2022/src/render3/util/change_detection_utils.mjs +3 -1
  36. package/esm2022/src/render3/util/misc_utils.mjs +2 -2
  37. package/esm2022/src/render3/view_manipulation.mjs +13 -5
  38. package/esm2022/src/render3/view_ref.mjs +7 -1
  39. package/esm2022/src/transfer_state.mjs +2 -2
  40. package/esm2022/src/util/performance.mjs +2 -2
  41. package/esm2022/src/version.mjs +1 -1
  42. package/esm2022/src/zone/ng_zone.mjs +10 -1
  43. package/esm2022/testing/src/component_fixture.mjs +20 -36
  44. package/esm2022/testing/src/logger.mjs +3 -3
  45. package/esm2022/testing/src/test_bed.mjs +5 -6
  46. package/fesm2022/core.mjs +1280 -1169
  47. package/fesm2022/core.mjs.map +1 -1
  48. package/fesm2022/primitives/signals.mjs +2 -9
  49. package/fesm2022/primitives/signals.mjs.map +1 -1
  50. package/fesm2022/rxjs-interop.mjs +1 -1
  51. package/fesm2022/testing.mjs +46 -64
  52. package/fesm2022/testing.mjs.map +1 -1
  53. package/index.d.ts +161 -21
  54. package/package.json +1 -1
  55. package/primitives/signals/index.d.ts +1 -1
  56. package/rxjs-interop/index.d.ts +1 -1
  57. package/schematics/migrations/block-template-entities/bundle.js +951 -429
  58. package/schematics/migrations/block-template-entities/bundle.js.map +4 -4
  59. package/schematics/ng-generate/control-flow-migration/bundle.js +1214 -497
  60. package/schematics/ng-generate/control-flow-migration/bundle.js.map +4 -4
  61. package/schematics/ng-generate/standalone-migration/bundle.js +2023 -1223
  62. package/schematics/ng-generate/standalone-migration/bundle.js.map +4 -4
  63. package/testing/index.d.ts +6 -10
  64. package/esm2022/src/application_config.mjs +0 -21
  65. package/esm2022/src/application_init.mjs +0 -188
  66. package/esm2022/src/application_module.mjs +0 -29
  67. package/esm2022/src/application_ref.mjs +0 -997
  68. package/esm2022/src/application_tokens.mjs +0 -121
  69. package/esm2022/src/platform_core_providers.mjs +0 -15
package/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v17.1.0-next.2
2
+ * @license Angular v17.1.0-next.4
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -2598,6 +2598,11 @@ declare interface DehydratedView {
2598
2598
  /**
2599
2599
  * A reference to the first child in a DOM segment associated
2600
2600
  * with a given hydration boundary.
2601
+ *
2602
+ * Once a view becomes hydrated, the value is set to `null`, which
2603
+ * indicates that further detaching/attaching view actions should result
2604
+ * in invoking corresponding DOM actions (attaching DOM nodes action is
2605
+ * skipped when we hydrate, since nodes are already in the DOM).
2601
2606
  */
2602
2607
  firstChild: RNode | null;
2603
2608
  /**
@@ -3610,7 +3615,6 @@ export declare type EnvironmentProviders = {
3610
3615
  ɵbrand: 'EnvironmentProviders';
3611
3616
  };
3612
3617
 
3613
-
3614
3618
  /**
3615
3619
  * Provides a hook for centralized exception handling.
3616
3620
  *
@@ -3843,6 +3847,16 @@ export declare interface FactorySansProvider {
3843
3847
 
3844
3848
  declare const FLAGS = 2;
3845
3849
 
3850
+ /**
3851
+ * Interface to an `EffectScheduler` capable of running scheduled effects synchronously.
3852
+ */
3853
+ declare interface FlushableEffectRunner {
3854
+ /**
3855
+ * Run any scheduled effects.
3856
+ */
3857
+ flush(): void;
3858
+ }
3859
+
3846
3860
  /**
3847
3861
  * Allows to refer to references which are not yet defined.
3848
3862
  *
@@ -5133,11 +5147,21 @@ export declare interface InputDecorator {
5133
5147
  new (arg?: string | Input): any;
5134
5148
  }
5135
5149
 
5150
+ /**
5151
+ * `InputSignal` is represents a special `Signal` for a directive/component input.
5152
+ *
5153
+ * An input signal is similar to a non-writable signal except that it also
5154
+ * carries additional type-information for transforms, and that Angular internally
5155
+ * updates the signal whenever a new value is bound.
5156
+ */
5157
+ export declare type InputSignal<ReadT, WriteT = ReadT> = Signal<ReadT> & {
5158
+ [ɵINPUT_SIGNAL_BRAND_READ_TYPE]: ReadT;
5159
+ [ɵINPUT_SIGNAL_BRAND_WRITE_TYPE]: WriteT;
5160
+ };
5161
+
5136
5162
  /** Function that can be used to transform incoming input values. */
5137
5163
  declare type InputTransformFunction = (value: any) => any;
5138
5164
 
5139
- declare type InputTransformFunction_2 = any;
5140
-
5141
5165
  /**
5142
5166
  * See `TNode.insertBeforeIndex`
5143
5167
  */
@@ -5556,6 +5580,8 @@ declare enum LContainerFlags {
5556
5580
  HasChildViewsToRefresh = 4
5557
5581
  }
5558
5582
 
5583
+ declare type LegacyInputPartialMapping = string | [bindingPropertyName: string, classPropertyName: string, transformFunction?: Function];
5584
+
5559
5585
  /**
5560
5586
  * Provide this token to set the locale of your application.
5561
5587
  * It is used for i18n extraction, by i18n pipes (DatePipe, I18nPluralPipe, CurrencyPipe,
@@ -5907,7 +5933,7 @@ declare interface LViewEnvironment {
5907
5933
  /** An optional custom sanitizer. */
5908
5934
  sanitizer: Sanitizer | null;
5909
5935
  /** Container for reactivity system `effect`s. */
5910
- inlineEffectRunner: ɵFlushableEffectRunner | null;
5936
+ inlineEffectRunner: FlushableEffectRunner | null;
5911
5937
  /** Container for after render hooks */
5912
5938
  afterRenderEventManager: ɵAfterRenderEventManager | null;
5913
5939
  }
@@ -7344,11 +7370,13 @@ declare interface R3DeclareDirectiveFacade {
7344
7370
  selector?: string;
7345
7371
  type: Type_2;
7346
7372
  inputs?: {
7347
- [classPropertyName: string]: string | [
7348
- bindingPropertyName: string,
7349
- classPropertyName: string,
7350
- transformFunction?: InputTransformFunction_2
7351
- ];
7373
+ [fieldName: string]: {
7374
+ classPropertyName: string;
7375
+ publicName: string;
7376
+ isSignal: boolean;
7377
+ isRequired: boolean;
7378
+ transformFunction: Function | null;
7379
+ } | LegacyInputPartialMapping;
7352
7380
  };
7353
7381
  outputs?: {
7354
7382
  [classPropertyName: string]: string;
@@ -11166,6 +11194,9 @@ export declare interface ɵDirectiveDef<T> {
11166
11194
  * A dictionary mapping the private names of inputs to their transformation functions.
11167
11195
  * Note: the private names are used for the keys, rather than the public ones, because public
11168
11196
  * names can be re-aliased in host directives which would invalidate the lookup.
11197
+ *
11198
+ * Note: Signal inputs will not have transforms captured here. This is because their
11199
+ * transform function is already integrated into the `InputSignal`.
11169
11200
  */
11170
11201
  readonly inputTransforms: {
11171
11202
  [classPropertyName: string]: InputTransformFunction;
@@ -11332,16 +11363,6 @@ export declare const enum ɵExtraLocaleDataIndex {
11332
11363
  */
11333
11364
  export declare function ɵfindLocaleData(locale: string): any;
11334
11365
 
11335
- /**
11336
- * Interface to an `EffectScheduler` capable of running scheduled effects synchronously.
11337
- */
11338
- export declare interface ɵFlushableEffectRunner {
11339
- /**
11340
- * Run any scheduled effects.
11341
- */
11342
- flush(): void;
11343
- }
11344
-
11345
11366
  /**
11346
11367
  * Loops over queued module definitions, if a given module definition has all of its
11347
11368
  * declarations resolved, it dequeues that module definition and sets the scope on
@@ -11558,6 +11579,116 @@ export declare interface ɵInjectorProfilerContext {
11558
11579
  token: Type<unknown> | null;
11559
11580
  }
11560
11581
 
11582
+ /**
11583
+ * Initializes an input with an initial value. If no explicit value
11584
+ * is specified, Angular will use `undefined`.
11585
+ *
11586
+ * Consider using `input.required` for inputs that don't need an
11587
+ * initial value.
11588
+ *
11589
+ * @usageNotes
11590
+ * Initialize an input in your directive or component by declaring a
11591
+ * class field and initializing it with the `input()` function.
11592
+ *
11593
+ * ```ts
11594
+ * @Directive({..})
11595
+ * export class MyDir {
11596
+ * firstName = input<string>(); // string|undefined
11597
+ * lastName = input.required<string>(); // string
11598
+ * age = input(0); // number
11599
+ * }
11600
+ * ```
11601
+ */
11602
+ export declare const ɵinput: ɵInputFunction;
11603
+
11604
+ declare const ɵINPUT_SIGNAL_BRAND_READ_TYPE: unique symbol;
11605
+
11606
+ export declare const ɵINPUT_SIGNAL_BRAND_WRITE_TYPE: unique symbol;
11607
+
11608
+ /**
11609
+ * Type of the `input` function.
11610
+ *
11611
+ * The input function is a special function that also provides access to
11612
+ * required inputs via the `.required` property.
11613
+ */
11614
+ export declare type ɵInputFunction = typeof ɵinputFunctionForApiGuard & {
11615
+ required: typeof ɵinputFunctionRequiredForApiGuard;
11616
+ };
11617
+
11618
+ /**
11619
+ * Initializes an input with an initial value. If no explicit value
11620
+ * is specified, Angular will use `undefined`.
11621
+ *
11622
+ * Consider using `input.required` for inputs that don't need an
11623
+ * initial value.
11624
+ *
11625
+ * @usageNotes
11626
+ * Initialize an input in your directive or component by declaring a
11627
+ * class field and initializing it with the `input()` function.
11628
+ *
11629
+ * ```ts
11630
+ * @Directive({..})
11631
+ * export class MyDir {
11632
+ * firstName = input<string>(); // string|undefined
11633
+ * lastName = input.required<string>(); // string
11634
+ * age = input(0); // number
11635
+ * }
11636
+ * ```
11637
+ */
11638
+ export declare function ɵinputFunctionForApiGuard<ReadT>(): InputSignal<ReadT | undefined>;
11639
+
11640
+ export declare function ɵinputFunctionForApiGuard<ReadT>(initialValue: ReadT, opts?: ɵInputOptionsWithoutTransform<ReadT>): InputSignal<ReadT>;
11641
+
11642
+ export declare function ɵinputFunctionForApiGuard<ReadT, WriteT>(initialValue: ReadT, opts: ɵInputOptionsWithTransform<ReadT, WriteT>): InputSignal<ReadT, WriteT>;
11643
+
11644
+ /**
11645
+ * Initializes a required input. Users of your directive/component,
11646
+ * need to bind to this input, otherwise they will see errors.
11647
+ * *
11648
+ * @usageNotes
11649
+ * Initialize an input in your directive or component by declaring a
11650
+ * class field and initializing it with the `input()` function.
11651
+ *
11652
+ * ```ts
11653
+ * @Directive({..})
11654
+ * export class MyDir {
11655
+ * firstName = input<string>(); // string|undefined
11656
+ * lastName = input.required<string>(); // string
11657
+ * age = input(0); // number
11658
+ * }
11659
+ * ```
11660
+ */
11661
+ export declare function ɵinputFunctionRequiredForApiGuard<ReadT>(opts?: ɵInputOptionsWithoutTransform<ReadT>): InputSignal<ReadT>;
11662
+
11663
+ export declare function ɵinputFunctionRequiredForApiGuard<ReadT, WriteT>(opts: ɵInputOptionsWithTransform<ReadT, WriteT>): InputSignal<ReadT, WriteT>;
11664
+
11665
+ /**
11666
+ * Options for signal inputs.
11667
+ */
11668
+ export declare interface ɵInputOptions<ReadT, WriteT> {
11669
+ /** Optional public name for the input. By default, the class field name is used. */
11670
+ alias?: string;
11671
+ /**
11672
+ * Optional transform that runs whenever a new value is bound. Can be used to
11673
+ * transform the input value before the input is updated.
11674
+ *
11675
+ * The transform function can widen the type of the input. For example, consider
11676
+ * an input for `disabled`. In practice, as the component author, you want to only
11677
+ * deal with a boolean, but users may want to bind a string if they just use the
11678
+ * attribute form to bind to the input via `<my-dir input>`. A transform can then
11679
+ * handle such string values and convert them to `boolean`. See: {@link booleanAttribute}.
11680
+ */
11681
+ transform?: (v: WriteT) => ReadT;
11682
+ }
11683
+
11684
+ /** Signal input options without the transform option. */
11685
+ export declare type ɵInputOptionsWithoutTransform<ReadT> = Omit<ɵInputOptions<ReadT, ReadT>, 'transform'> & {
11686
+ transform?: undefined;
11687
+ };
11688
+
11689
+ /** Signal input options with the transform option required. */
11690
+ export declare type ɵInputOptionsWithTransform<ReadT, WriteT> = Required<Pick<ɵInputOptions<ReadT, WriteT>, 'transform'>> & ɵInputOptions<ReadT, WriteT>;
11691
+
11561
11692
  /**
11562
11693
  * Register a callback to run once before any userspace `afterRender` or
11563
11694
  * `afterNextRender` callbacks.
@@ -12438,6 +12569,14 @@ export declare function ɵtruncateMiddle(str: string, maxLength?: number): strin
12438
12569
  */
12439
12570
  export declare function ɵunregisterLocaleData(): void;
12440
12571
 
12572
+ /** Unwraps all `InputSignal` class fields of the given directive. */
12573
+ export declare type ɵUnwrapDirectiveSignalInputs<Dir, Fields extends keyof Dir> = {
12574
+ [P in Fields]: ɵUnwrapInputSignalWriteType<Dir[P]>;
12575
+ };
12576
+
12577
+ /** Retrieves the `WriteT` of an `InputSignal`. */
12578
+ declare type ɵUnwrapInputSignalWriteType<Field> = Field extends InputSignal<unknown, infer WriteT> ? WriteT : never;
12579
+
12441
12580
  export declare function ɵunwrapSafeValue(value: ɵSafeValue): string;
12442
12581
 
12443
12582
  export declare function ɵunwrapSafeValue<T>(value: T): T;
@@ -12726,7 +12865,7 @@ export declare const ɵXSS_SECURITY_URL = "https://g.co/ng/security#xss";
12726
12865
  * An `EffectScheduler` which is capable of queueing scheduled effects per-zone, and flushing them
12727
12866
  * as an explicit operation.
12728
12867
  */
12729
- export declare class ɵZoneAwareQueueingScheduler implements ɵEffectScheduler, ɵFlushableEffectRunner {
12868
+ export declare class ɵZoneAwareQueueingScheduler implements ɵEffectScheduler, FlushableEffectRunner {
12730
12869
  private queuedEffectCount;
12731
12870
  private queues;
12732
12871
  scheduleEffect(handle: SchedulableEffect): void;
@@ -13723,6 +13862,7 @@ export declare type ɵɵDirectiveDeclaration<T, Selector extends string, ExportA
13723
13862
  [key: string]: string | {
13724
13863
  alias: string | null;
13725
13864
  required: boolean;
13865
+ isSignal?: boolean;
13726
13866
  };
13727
13867
  }, OutputMap extends {
13728
13868
  [key: string]: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular/core",
3
- "version": "17.1.0-next.2",
3
+ "version": "17.1.0-next.4",
4
4
  "description": "Angular - the core framework",
5
5
  "author": "angular",
6
6
  "license": "MIT",
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v17.1.0-next.2
2
+ * @license Angular v17.1.0-next.4
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 v17.1.0-next.2
2
+ * @license Angular v17.1.0-next.4
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */