@angular/core 17.1.0-next.3 → 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 (67) 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 +1 -1
  20. package/esm2022/src/hydration/api.mjs +2 -2
  21. package/esm2022/src/hydration/cleanup.mjs +1 -1
  22. package/esm2022/src/image_performance_warning.mjs +2 -2
  23. package/esm2022/src/linker/query_list.mjs +8 -6
  24. package/esm2022/src/metadata/do_bootstrap.mjs +1 -1
  25. package/esm2022/src/platform/platform.mjs +135 -0
  26. package/esm2022/src/platform/platform_core_providers.mjs +15 -0
  27. package/esm2022/src/platform/platform_ref.mjs +179 -0
  28. package/esm2022/src/render3/instructions/change_detection.mjs +2 -4
  29. package/esm2022/src/render3/interfaces/definition.mjs +1 -1
  30. package/esm2022/src/render3/interfaces/public_definitions.mjs +1 -1
  31. package/esm2022/src/render3/list_reconciliation.mjs +58 -24
  32. package/esm2022/src/render3/util/change_detection_utils.mjs +3 -1
  33. package/esm2022/src/render3/util/misc_utils.mjs +2 -2
  34. package/esm2022/src/render3/view_ref.mjs +7 -1
  35. package/esm2022/src/transfer_state.mjs +2 -2
  36. package/esm2022/src/util/performance.mjs +2 -2
  37. package/esm2022/src/version.mjs +1 -1
  38. package/esm2022/src/zone/ng_zone.mjs +10 -1
  39. package/esm2022/testing/src/component_fixture.mjs +20 -36
  40. package/esm2022/testing/src/logger.mjs +3 -3
  41. package/esm2022/testing/src/test_bed.mjs +5 -6
  42. package/fesm2022/core.mjs +1343 -1271
  43. package/fesm2022/core.mjs.map +1 -1
  44. package/fesm2022/primitives/signals.mjs +2 -9
  45. package/fesm2022/primitives/signals.mjs.map +1 -1
  46. package/fesm2022/rxjs-interop.mjs +1 -1
  47. package/fesm2022/testing.mjs +46 -64
  48. package/fesm2022/testing.mjs.map +1 -1
  49. package/index.d.ts +156 -21
  50. package/package.json +1 -1
  51. package/primitives/signals/index.d.ts +1 -1
  52. package/rxjs-interop/index.d.ts +1 -1
  53. package/schematics/migrations/block-template-entities/bundle.js +674 -500
  54. package/schematics/migrations/block-template-entities/bundle.js.map +3 -3
  55. package/schematics/migrations/compiler-options/bundle.js +13 -13
  56. package/schematics/migrations/transfer-state/bundle.js +13 -13
  57. package/schematics/ng-generate/control-flow-migration/bundle.js +830 -552
  58. package/schematics/ng-generate/control-flow-migration/bundle.js.map +3 -3
  59. package/schematics/ng-generate/standalone-migration/bundle.js +1958 -1532
  60. package/schematics/ng-generate/standalone-migration/bundle.js.map +4 -4
  61. package/testing/index.d.ts +6 -10
  62. package/esm2022/src/application_config.mjs +0 -21
  63. package/esm2022/src/application_init.mjs +0 -188
  64. package/esm2022/src/application_module.mjs +0 -29
  65. package/esm2022/src/application_ref.mjs +0 -997
  66. package/esm2022/src/application_tokens.mjs +0 -121
  67. 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.3
2
+ * @license Angular v17.1.0-next.4
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -3615,7 +3615,6 @@ export declare type EnvironmentProviders = {
3615
3615
  ɵbrand: 'EnvironmentProviders';
3616
3616
  };
3617
3617
 
3618
-
3619
3618
  /**
3620
3619
  * Provides a hook for centralized exception handling.
3621
3620
  *
@@ -3848,6 +3847,16 @@ export declare interface FactorySansProvider {
3848
3847
 
3849
3848
  declare const FLAGS = 2;
3850
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
+
3851
3860
  /**
3852
3861
  * Allows to refer to references which are not yet defined.
3853
3862
  *
@@ -5138,11 +5147,21 @@ export declare interface InputDecorator {
5138
5147
  new (arg?: string | Input): any;
5139
5148
  }
5140
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
+
5141
5162
  /** Function that can be used to transform incoming input values. */
5142
5163
  declare type InputTransformFunction = (value: any) => any;
5143
5164
 
5144
- declare type InputTransformFunction_2 = any;
5145
-
5146
5165
  /**
5147
5166
  * See `TNode.insertBeforeIndex`
5148
5167
  */
@@ -5561,6 +5580,8 @@ declare enum LContainerFlags {
5561
5580
  HasChildViewsToRefresh = 4
5562
5581
  }
5563
5582
 
5583
+ declare type LegacyInputPartialMapping = string | [bindingPropertyName: string, classPropertyName: string, transformFunction?: Function];
5584
+
5564
5585
  /**
5565
5586
  * Provide this token to set the locale of your application.
5566
5587
  * It is used for i18n extraction, by i18n pipes (DatePipe, I18nPluralPipe, CurrencyPipe,
@@ -5912,7 +5933,7 @@ declare interface LViewEnvironment {
5912
5933
  /** An optional custom sanitizer. */
5913
5934
  sanitizer: Sanitizer | null;
5914
5935
  /** Container for reactivity system `effect`s. */
5915
- inlineEffectRunner: ɵFlushableEffectRunner | null;
5936
+ inlineEffectRunner: FlushableEffectRunner | null;
5916
5937
  /** Container for after render hooks */
5917
5938
  afterRenderEventManager: ɵAfterRenderEventManager | null;
5918
5939
  }
@@ -7349,11 +7370,13 @@ declare interface R3DeclareDirectiveFacade {
7349
7370
  selector?: string;
7350
7371
  type: Type_2;
7351
7372
  inputs?: {
7352
- [classPropertyName: string]: string | [
7353
- bindingPropertyName: string,
7354
- classPropertyName: string,
7355
- transformFunction?: InputTransformFunction_2
7356
- ];
7373
+ [fieldName: string]: {
7374
+ classPropertyName: string;
7375
+ publicName: string;
7376
+ isSignal: boolean;
7377
+ isRequired: boolean;
7378
+ transformFunction: Function | null;
7379
+ } | LegacyInputPartialMapping;
7357
7380
  };
7358
7381
  outputs?: {
7359
7382
  [classPropertyName: string]: string;
@@ -11171,6 +11194,9 @@ export declare interface ɵDirectiveDef<T> {
11171
11194
  * A dictionary mapping the private names of inputs to their transformation functions.
11172
11195
  * Note: the private names are used for the keys, rather than the public ones, because public
11173
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`.
11174
11200
  */
11175
11201
  readonly inputTransforms: {
11176
11202
  [classPropertyName: string]: InputTransformFunction;
@@ -11337,16 +11363,6 @@ export declare const enum ɵExtraLocaleDataIndex {
11337
11363
  */
11338
11364
  export declare function ɵfindLocaleData(locale: string): any;
11339
11365
 
11340
- /**
11341
- * Interface to an `EffectScheduler` capable of running scheduled effects synchronously.
11342
- */
11343
- export declare interface ɵFlushableEffectRunner {
11344
- /**
11345
- * Run any scheduled effects.
11346
- */
11347
- flush(): void;
11348
- }
11349
-
11350
11366
  /**
11351
11367
  * Loops over queued module definitions, if a given module definition has all of its
11352
11368
  * declarations resolved, it dequeues that module definition and sets the scope on
@@ -11563,6 +11579,116 @@ export declare interface ɵInjectorProfilerContext {
11563
11579
  token: Type<unknown> | null;
11564
11580
  }
11565
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
+
11566
11692
  /**
11567
11693
  * Register a callback to run once before any userspace `afterRender` or
11568
11694
  * `afterNextRender` callbacks.
@@ -12443,6 +12569,14 @@ export declare function ɵtruncateMiddle(str: string, maxLength?: number): strin
12443
12569
  */
12444
12570
  export declare function ɵunregisterLocaleData(): void;
12445
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
+
12446
12580
  export declare function ɵunwrapSafeValue(value: ɵSafeValue): string;
12447
12581
 
12448
12582
  export declare function ɵunwrapSafeValue<T>(value: T): T;
@@ -12731,7 +12865,7 @@ export declare const ɵXSS_SECURITY_URL = "https://g.co/ng/security#xss";
12731
12865
  * An `EffectScheduler` which is capable of queueing scheduled effects per-zone, and flushing them
12732
12866
  * as an explicit operation.
12733
12867
  */
12734
- export declare class ɵZoneAwareQueueingScheduler implements ɵEffectScheduler, ɵFlushableEffectRunner {
12868
+ export declare class ɵZoneAwareQueueingScheduler implements ɵEffectScheduler, FlushableEffectRunner {
12735
12869
  private queuedEffectCount;
12736
12870
  private queues;
12737
12871
  scheduleEffect(handle: SchedulableEffect): void;
@@ -13728,6 +13862,7 @@ export declare type ɵɵDirectiveDeclaration<T, Selector extends string, ExportA
13728
13862
  [key: string]: string | {
13729
13863
  alias: string | null;
13730
13864
  required: boolean;
13865
+ isSignal?: boolean;
13731
13866
  };
13732
13867
  }, OutputMap extends {
13733
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.3",
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.3
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.3
2
+ * @license Angular v17.1.0-next.4
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */