@angular/core 17.1.2 → 17.1.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 (36) hide show
  1. package/esm2022/src/application/application_ref.mjs +54 -16
  2. package/esm2022/src/authoring/input.mjs +1 -1
  3. package/esm2022/src/authoring/input_signal.mjs +1 -1
  4. package/esm2022/src/authoring/input_type_checking.mjs +1 -1
  5. package/esm2022/src/authoring.mjs +1 -1
  6. package/esm2022/src/defer/instructions.mjs +13 -6
  7. package/esm2022/src/render3/after_render_hooks.mjs +2 -6
  8. package/esm2022/src/render3/component_ref.mjs +1 -1
  9. package/esm2022/src/render3/definition.mjs +1 -1
  10. package/esm2022/src/render3/errors_di.mjs +2 -2
  11. package/esm2022/src/render3/i18n/i18n_locale_id.mjs +2 -2
  12. package/esm2022/src/render3/instructions/change_detection.mjs +6 -6
  13. package/esm2022/src/render3/instructions/write_to_directive_input.mjs +1 -1
  14. package/esm2022/src/render3/util/view_utils.mjs +3 -3
  15. package/esm2022/src/render3/view_ref.mjs +1 -1
  16. package/esm2022/src/util/stringify.mjs +2 -2
  17. package/esm2022/src/version.mjs +1 -1
  18. package/esm2022/testing/src/component_fixture.mjs +4 -4
  19. package/esm2022/testing/src/logger.mjs +3 -3
  20. package/fesm2022/core.mjs +438 -401
  21. package/fesm2022/core.mjs.map +1 -1
  22. package/fesm2022/primitives/signals.mjs +1 -1
  23. package/fesm2022/rxjs-interop.mjs +1 -1
  24. package/fesm2022/testing.mjs +4 -4
  25. package/fesm2022/testing.mjs.map +1 -1
  26. package/index.d.ts +49 -17
  27. package/package.json +1 -1
  28. package/primitives/signals/index.d.ts +1 -1
  29. package/rxjs-interop/index.d.ts +1 -1
  30. package/schematics/migrations/block-template-entities/bundle.js +27 -9
  31. package/schematics/migrations/block-template-entities/bundle.js.map +2 -2
  32. package/schematics/ng-generate/control-flow-migration/bundle.js +27 -9
  33. package/schematics/ng-generate/control-flow-migration/bundle.js.map +2 -2
  34. package/schematics/ng-generate/standalone-migration/bundle.js +176 -77
  35. package/schematics/ng-generate/standalone-migration/bundle.js.map +3 -3
  36. package/testing/index.d.ts +1 -1
package/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v17.1.2
2
+ * @license Angular v17.1.3
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -756,6 +756,8 @@ export declare class ApplicationRef {
756
756
  * detection pass during which all change detection must complete.
757
757
  */
758
758
  tick(): void;
759
+ private detectChangesInAttachedViews;
760
+ private detectChangesInView;
759
761
  /**
760
762
  * Attaches a view so that it will be dirty checked.
761
763
  * The view will be automatically detached when it is destroyed.
@@ -3327,9 +3329,7 @@ declare type DirectiveDefListOrFactory = (() => DirectiveDefList) | DirectiveDef
3327
3329
  * - Because declared and public name are usually same we only generate the array
3328
3330
  * `['declared', 'public']` format when they differ, or there is a transform.
3329
3331
  * - The reason why this API and `outputs` API is not the same is that `NgOnChanges` has
3330
- * inconsistent behavior in that it uses declared names rather than minified or public. For
3331
- * this reason `NgOnChanges` will be deprecated and removed in future version and this
3332
- * API will be simplified to be consistent with `output`.
3332
+ * inconsistent behavior in that it uses declared names rather than minified or public.
3333
3333
  */
3334
3334
  declare type DirectiveInputs<T> = {
3335
3335
  [P in keyof T]?: string | [
@@ -5490,7 +5490,7 @@ export declare interface InputFunction {
5490
5490
  */
5491
5491
  <ReadT>(): InputSignal<ReadT | undefined>;
5492
5492
  <ReadT>(initialValue: ReadT, opts?: InputOptionsWithoutTransform<ReadT>): InputSignal<ReadT>;
5493
- <ReadT, WriteT>(initialValue: ReadT, opts: InputOptionsWithTransform<ReadT, WriteT>): InputSignal<ReadT, WriteT>;
5493
+ <ReadT, WriteT>(initialValue: ReadT, opts: InputOptionsWithTransform<ReadT, WriteT>): InputSignalWithTransform<ReadT, WriteT>;
5494
5494
  /**
5495
5495
  * Initializes a required input.
5496
5496
  *
@@ -5501,7 +5501,7 @@ export declare interface InputFunction {
5501
5501
  */
5502
5502
  required: {
5503
5503
  <ReadT>(opts?: InputOptionsWithoutTransform<ReadT>): InputSignal<ReadT>;
5504
- <ReadT, WriteT>(opts: InputOptionsWithTransform<ReadT, WriteT>): InputSignal<ReadT, WriteT>;
5504
+ <ReadT, WriteT>(opts: InputOptionsWithTransform<ReadT, WriteT>): InputSignalWithTransform<ReadT, WriteT>;
5505
5505
  };
5506
5506
  }
5507
5507
 
@@ -5543,18 +5543,17 @@ export declare type InputOptionsWithoutTransform<ReadT> = Omit<InputOptions<Read
5543
5543
  export declare type InputOptionsWithTransform<ReadT, WriteT> = Required<Pick<InputOptions<ReadT, WriteT>, 'transform'>> & InputOptions<ReadT, WriteT>;
5544
5544
 
5545
5545
  /**
5546
- * `InputSignal` is represents a special `Signal` for a directive/component input.
5546
+ * `InputSignal` represents a special `Signal` for a directive/component input.
5547
5547
  *
5548
5548
  * An input signal is similar to a non-writable signal except that it also
5549
5549
  * carries additional type-information for transforms, and that Angular internally
5550
5550
  * updates the signal whenever a new value is bound.
5551
5551
  *
5552
+ * @see {@link InputOptionsWithTransform} for inputs with transforms.
5553
+ *
5552
5554
  * @developerPreview
5553
5555
  */
5554
- export declare interface InputSignal<ReadT, WriteT = ReadT> extends Signal<ReadT> {
5555
- [SIGNAL]: InputSignalNode<ReadT, WriteT>;
5556
- [ɵINPUT_SIGNAL_BRAND_READ_TYPE]: ReadT;
5557
- [ɵINPUT_SIGNAL_BRAND_WRITE_TYPE]: WriteT;
5556
+ export declare interface InputSignal<ReadT> extends InputSignalWithTransform<ReadT, ReadT> {
5558
5557
  }
5559
5558
 
5560
5559
  /**
@@ -5578,6 +5577,36 @@ declare interface InputSignalNode<ReadT, WriteT> extends SignalNode<ReadT | type
5578
5577
  applyValueToInputSignal<ReadT, WriteT>(node: InputSignalNode<ReadT, WriteT>, value: ReadT): void;
5579
5578
  }
5580
5579
 
5580
+ /**
5581
+ * `InputSignalWithTransform` represents a special `Signal` for a
5582
+ * directive/component input with a `transform` function.
5583
+ *
5584
+ * Signal inputs with transforms capture an extra generic for their transform write
5585
+ * type. Transforms can expand the accepted bound values for an input while ensuring
5586
+ * value retrievals of the signal input are still matching the generic input type.
5587
+ *
5588
+ * ```ts
5589
+ * class MyDir {
5590
+ * disabled = input(false, {
5591
+ * transform: (v: string|boolean) => convertToBoolean(v),
5592
+ * }); // InputSignalWithTransform<boolean, string|boolean>
5593
+ *
5594
+ * click() {
5595
+ * this.disabled() // always returns a `boolean`.
5596
+ * }
5597
+ * }
5598
+ * ```
5599
+ *
5600
+ * @see {@link InputSignal} for additional information.
5601
+ *
5602
+ * @developerPreview
5603
+ */
5604
+ export declare interface InputSignalWithTransform<ReadT, WriteT> extends Signal<ReadT> {
5605
+ [SIGNAL]: InputSignalNode<ReadT, WriteT>;
5606
+ [ɵINPUT_SIGNAL_BRAND_READ_TYPE]: ReadT;
5607
+ [ɵINPUT_SIGNAL_BRAND_WRITE_TYPE]: WriteT;
5608
+ }
5609
+
5581
5610
  /** Function that can be used to transform incoming input values. */
5582
5611
  declare type InputTransformFunction = (value: any) => any;
5583
5612
 
@@ -11108,7 +11137,7 @@ export declare class ɵAfterRenderEventManager {
11108
11137
  /**
11109
11138
  * Executes callbacks. Returns `true` if any callbacks executed.
11110
11139
  */
11111
- execute(): boolean;
11140
+ execute(): void;
11112
11141
  ngOnDestroy(): void;
11113
11142
  /** @nocollapse */
11114
11143
  static ɵprov: unknown;
@@ -12999,7 +13028,7 @@ export declare function ɵtriggerResourceLoading(tDetails: TDeferBlockDetails, l
12999
13028
  *
13000
13029
  * @param string
13001
13030
  * @param maxLength of the output string
13002
- * @returns elispsed string with ... in the middle
13031
+ * @returns ellipsed string with ... in the middle
13003
13032
  */
13004
13033
  export declare function ɵtruncateMiddle(str: string, maxLength?: number): string;
13005
13034
 
@@ -13008,13 +13037,16 @@ export declare function ɵtruncateMiddle(str: string, maxLength?: number): strin
13008
13037
  */
13009
13038
  export declare function ɵunregisterLocaleData(): void;
13010
13039
 
13011
- /** Unwraps all `InputSignal` class fields of the given directive. */
13040
+ /**
13041
+ * Unwraps all `InputSignal`/`InputSignalWithTransform` class fields of
13042
+ * the given directive.
13043
+ */
13012
13044
  export declare type ɵUnwrapDirectiveSignalInputs<Dir, Fields extends keyof Dir> = {
13013
13045
  [P in Fields]: ɵUnwrapInputSignalWriteType<Dir[P]>;
13014
13046
  };
13015
13047
 
13016
- /** Retrieves the `WriteT` of an `InputSignal`. */
13017
- declare type ɵUnwrapInputSignalWriteType<Field> = Field extends InputSignal<unknown, infer WriteT> ? WriteT : never;
13048
+ /** Retrieves the `WriteT` of an `InputSignal` and `InputSignalWithTransform`. */
13049
+ declare type ɵUnwrapInputSignalWriteType<Field> = Field extends InputSignalWithTransform<unknown, infer WriteT> ? WriteT : never;
13018
13050
 
13019
13051
  export declare function ɵunwrapSafeValue(value: ɵSafeValue): string;
13020
13052
 
@@ -13037,7 +13069,7 @@ export declare class ɵViewRef<T> implements EmbeddedViewRef<T>, ChangeDetectorR
13037
13069
  * This may be different from `_lView` if the `_cdRefInjectingView` is an embedded view.
13038
13070
  */
13039
13071
  private _cdRefInjectingView?;
13040
- private readonly notifyErrorHandler;
13072
+ readonly notifyErrorHandler: boolean;
13041
13073
  private _appRef;
13042
13074
  private _attachedToViewContainer;
13043
13075
  get rootNodes(): any[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular/core",
3
- "version": "17.1.2",
3
+ "version": "17.1.3",
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.2
2
+ * @license Angular v17.1.3
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.2
2
+ * @license Angular v17.1.3
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -1821,6 +1821,7 @@ var ConstantPool = class {
1821
1821
  this.literals = /* @__PURE__ */ new Map();
1822
1822
  this.literalFactories = /* @__PURE__ */ new Map();
1823
1823
  this.sharedConstants = /* @__PURE__ */ new Map();
1824
+ this._claimedNames = /* @__PURE__ */ new Map();
1824
1825
  this.nextNameIndex = 0;
1825
1826
  }
1826
1827
  getConstLiteral(literal2, forceShared) {
@@ -1913,8 +1914,12 @@ var ConstantPool = class {
1913
1914
  }
1914
1915
  return { literalFactory, literalFactoryArguments };
1915
1916
  }
1916
- uniqueName(prefix) {
1917
- return `${prefix}${this.nextNameIndex++}`;
1917
+ uniqueName(name, alwaysIncludeSuffix = true) {
1918
+ var _a2;
1919
+ const count = (_a2 = this._claimedNames.get(name)) != null ? _a2 : 0;
1920
+ const result = count === 0 && !alwaysIncludeSuffix ? `${name}` : `${name}${count}`;
1921
+ this._claimedNames.set(name, count + 1);
1922
+ return result;
1918
1923
  }
1919
1924
  freshName() {
1920
1925
  return this.uniqueName(CONSTANT_PREFIX);
@@ -9571,7 +9576,10 @@ function createDeferDepsFns(job) {
9571
9576
  const dependencies = [];
9572
9577
  for (const dep of op.metadata.deps) {
9573
9578
  if (dep.isDeferrable) {
9574
- const innerFn = arrowFn([new FnParam("m", DYNAMIC_TYPE)], variable("m").prop(dep.symbolName));
9579
+ const innerFn = arrowFn(
9580
+ [new FnParam("m", DYNAMIC_TYPE)],
9581
+ variable("m").prop(dep.isDefaultImport ? "default" : dep.symbolName)
9582
+ );
9575
9583
  const importExpr2 = new DynamicImportExpr(dep.importPath).prop("then").callFn([innerFn]);
9576
9584
  dependencies.push(importExpr2);
9577
9585
  } else {
@@ -16649,7 +16657,7 @@ function nameFunctionsAndVariables(job) {
16649
16657
  }
16650
16658
  function addNamesToView(unit, baseName, state, compatibility) {
16651
16659
  if (unit.fnName === null) {
16652
- unit.fnName = sanitizeIdentifier(`${baseName}_${unit.job.fnSuffix}`);
16660
+ unit.fnName = unit.job.pool.uniqueName(sanitizeIdentifier(`${baseName}_${unit.job.fnSuffix}`), false);
16653
16661
  }
16654
16662
  const varNames = /* @__PURE__ */ new Map();
16655
16663
  for (const op of unit.ops()) {
@@ -19927,11 +19935,18 @@ function asMessage(i18nMeta) {
19927
19935
  function ingestElementBindings(unit, op, element2) {
19928
19936
  var _a2;
19929
19937
  let bindings = new Array();
19938
+ let i18nAttributeBindingNames = /* @__PURE__ */ new Set();
19930
19939
  for (const attr of element2.attributes) {
19931
19940
  const securityContext = domSchema.securityContext(element2.name, attr.name, true);
19932
19941
  bindings.push(createBindingOp(op.xref, BindingKind.Attribute, attr.name, convertAstWithInterpolation(unit.job, attr.value, attr.i18n), null, securityContext, true, false, null, asMessage(attr.i18n), attr.sourceSpan));
19942
+ if (attr.i18n) {
19943
+ i18nAttributeBindingNames.add(attr.name);
19944
+ }
19933
19945
  }
19934
19946
  for (const input of element2.inputs) {
19947
+ if (i18nAttributeBindingNames.has(input.name)) {
19948
+ console.error(`On component ${unit.job.componentName}, the binding ${input.name} is both an i18n attribute and a property. You may want to remove the property binding. This will become a compilation error in future versions of Angular.`);
19949
+ }
19935
19950
  bindings.push(createBindingOp(op.xref, BINDING_KINDS.get(input.type), input.name, convertAstWithInterpolation(unit.job, astOf(input.value), input.i18n), input.unit, input.securityContext, false, false, null, (_a2 = asMessage(input.i18n)) != null ? _a2 : null, input.sourceSpan));
19936
19951
  }
19937
19952
  unit.create.push(bindings.filter((b) => (b == null ? void 0 : b.kind) === OpKind.ExtractedAttribute));
@@ -22720,7 +22735,7 @@ var TemplateDefinitionBuilder = class {
22720
22735
  }
22721
22736
  }
22722
22737
  const contextName = `${this.contextName}${contextNameSuffix}_${index}`;
22723
- const name = `${contextName}_Template`;
22738
+ const name = this.constantPool.uniqueName(`${contextName}_Template`, false);
22724
22739
  const visitor = new TemplateDefinitionBuilder(this.constantPool, this._bindingScope, this.level + 1, contextName, this.i18n, index, name, this._namespace, this.fileBasedI18nSuffix, this.i18nUseExternalIds, this.deferBlocks, this.elementLocations, this.allDeferrableDepsFn, this._constants);
22725
22740
  this._nestedTemplateFns.push(() => {
22726
22741
  const templateFunctionExpr = visitor.buildTemplateFunction(children, variables, this._ngContentReservedSlots.length + this._ngContentSelectorsOffset, i18nMeta, variableAliases);
@@ -22929,7 +22944,10 @@ var TemplateDefinitionBuilder = class {
22929
22944
  const dependencyExp = [];
22930
22945
  for (const deferredDep of metadata.deps) {
22931
22946
  if (deferredDep.isDeferrable) {
22932
- const innerFn = arrowFn([new FnParam("m", DYNAMIC_TYPE)], variable("m").prop(deferredDep.symbolName));
22947
+ const innerFn = arrowFn(
22948
+ [new FnParam("m", DYNAMIC_TYPE)],
22949
+ variable("m").prop(deferredDep.isDefaultImport ? "default" : deferredDep.symbolName)
22950
+ );
22933
22951
  const importExpr2 = new DynamicImportExpr(deferredDep.importPath).prop("then").callFn([innerFn]);
22934
22952
  dependencyExp.push(importExpr2);
22935
22953
  } else {
@@ -23926,8 +23944,8 @@ function compileDirectiveFromMetadata(meta, constantPool, bindingParser) {
23926
23944
  }
23927
23945
  function createDeferredDepsFunction(constantPool, name, deps) {
23928
23946
  const dependencyExp = [];
23929
- for (const [symbolName, importPath] of deps) {
23930
- const innerFn = arrowFn([new FnParam("m", DYNAMIC_TYPE)], variable("m").prop(symbolName));
23947
+ for (const [symbolName, { importPath, isDefaultImport }] of deps) {
23948
+ const innerFn = arrowFn([new FnParam("m", DYNAMIC_TYPE)], variable("m").prop(isDefaultImport ? "default" : symbolName));
23931
23949
  const importExpr2 = new DynamicImportExpr(importPath).prop("then").callFn([innerFn]);
23932
23950
  dependencyExp.push(importExpr2);
23933
23951
  }
@@ -25673,7 +25691,7 @@ function publishFacade(global) {
25673
25691
  }
25674
25692
 
25675
25693
  // bazel-out/k8-fastbuild/bin/packages/compiler/src/version.mjs
25676
- var VERSION2 = new Version("17.1.2");
25694
+ var VERSION2 = new Version("17.1.3");
25677
25695
 
25678
25696
  // bazel-out/k8-fastbuild/bin/packages/compiler/src/i18n/extractor_merger.mjs
25679
25697
  var _VisitorMode;