@angular/core 17.1.2 → 17.2.0-next.1

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 (41) hide show
  1. package/esm2022/primitives/signals/index.mjs +2 -2
  2. package/esm2022/src/application/application_tokens.mjs +2 -1
  3. package/esm2022/src/authoring/input.mjs +1 -1
  4. package/esm2022/src/authoring/input_signal.mjs +4 -1
  5. package/esm2022/src/authoring/input_type_checking.mjs +1 -1
  6. package/esm2022/src/authoring/queries.mjs +114 -0
  7. package/esm2022/src/authoring.mjs +1 -1
  8. package/esm2022/src/compiler/compiler_facade_interface.mjs +1 -1
  9. package/esm2022/src/core_render3_private_export.mjs +2 -2
  10. package/esm2022/src/linker/query_list.mjs +7 -1
  11. package/esm2022/src/metadata/di.mjs +7 -7
  12. package/esm2022/src/render3/component_ref.mjs +1 -1
  13. package/esm2022/src/render3/index.mjs +2 -2
  14. package/esm2022/src/render3/instructions/all.mjs +2 -1
  15. package/esm2022/src/render3/instructions/queries.mjs +6 -25
  16. package/esm2022/src/render3/instructions/queries_signals.mjs +55 -0
  17. package/esm2022/src/render3/instructions/write_to_directive_input.mjs +1 -1
  18. package/esm2022/src/render3/jit/directive.mjs +2 -1
  19. package/esm2022/src/render3/jit/environment.mjs +4 -1
  20. package/esm2022/src/render3/query.mjs +46 -7
  21. package/esm2022/src/render3/query_reactive.mjs +110 -0
  22. package/esm2022/src/render3/reactivity/computed.mjs +4 -1
  23. package/esm2022/src/render3/reactivity/signal.mjs +4 -1
  24. package/esm2022/src/version.mjs +1 -1
  25. package/esm2022/testing/src/logger.mjs +3 -3
  26. package/fesm2022/core.mjs +217 -36
  27. package/fesm2022/core.mjs.map +1 -1
  28. package/fesm2022/primitives/signals.mjs +2 -2
  29. package/fesm2022/rxjs-interop.mjs +1 -1
  30. package/fesm2022/testing.mjs +1 -1
  31. package/index.d.ts +90 -14
  32. package/package.json +1 -1
  33. package/primitives/signals/index.d.ts +3 -1
  34. package/rxjs-interop/index.d.ts +1 -1
  35. package/schematics/migrations/block-template-entities/bundle.js +615 -549
  36. package/schematics/migrations/block-template-entities/bundle.js.map +4 -4
  37. package/schematics/ng-generate/control-flow-migration/bundle.js +615 -549
  38. package/schematics/ng-generate/control-flow-migration/bundle.js.map +4 -4
  39. package/schematics/ng-generate/standalone-migration/bundle.js +2159 -1686
  40. package/schematics/ng-generate/standalone-migration/bundle.js.map +4 -4
  41. package/testing/index.d.ts +1 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v17.1.2
2
+ * @license Angular v17.2.0-next.1
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -549,5 +549,5 @@ function setAlternateWeakRefImpl(impl) {
549
549
  // TODO: remove this function
550
550
  }
551
551
 
552
- export { REACTIVE_NODE, SIGNAL, SIGNAL_NODE, consumerAfterComputation, consumerBeforeComputation, consumerDestroy, consumerPollProducersForChange, createComputed, createSignal, createWatch, defaultEquals, getActiveConsumer, isInNotificationPhase, isReactive, producerAccessed, producerNotifyConsumers, producerUpdateValueVersion, producerUpdatesAllowed, setActiveConsumer, setAlternateWeakRefImpl, setPostSignalSetFn, setThrowInvalidWriteToSignalError, signalSetFn, signalUpdateFn };
552
+ export { REACTIVE_NODE, SIGNAL, SIGNAL_NODE, consumerAfterComputation, consumerBeforeComputation, consumerDestroy, consumerMarkDirty, consumerPollProducersForChange, createComputed, createSignal, createWatch, defaultEquals, getActiveConsumer, isInNotificationPhase, isReactive, producerAccessed, producerNotifyConsumers, producerUpdateValueVersion, producerUpdatesAllowed, setActiveConsumer, setAlternateWeakRefImpl, setPostSignalSetFn, setThrowInvalidWriteToSignalError, signalSetFn, signalUpdateFn };
553
553
  //# sourceMappingURL=signals.mjs.map
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v17.1.2
2
+ * @license Angular v17.2.0-next.1
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.2.0-next.1
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
package/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v17.1.2
2
+ * @license Angular v17.2.0-next.1
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -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
 
@@ -7725,6 +7754,7 @@ declare const enum QueryFlags {
7725
7754
  export declare class QueryList<T> implements Iterable<T> {
7726
7755
  private _emitDistinctChangesOnly;
7727
7756
  readonly dirty = true;
7757
+ private _onDirty?;
7728
7758
  private _results;
7729
7759
  private _changesDetected;
7730
7760
  private _changes;
@@ -7938,6 +7968,7 @@ declare interface R3DeclareQueryMetadataFacade {
7938
7968
  read?: OpaqueValue;
7939
7969
  static?: boolean;
7940
7970
  emitDistinctChangesOnly?: boolean;
7971
+ isSignal?: boolean;
7941
7972
  }
7942
7973
 
7943
7974
  declare type R3DeclareTemplateDependencyFacade = {
@@ -12054,6 +12085,7 @@ export declare const ɵIMAGE_CONFIG_DEFAULTS: ɵImageConfig;
12054
12085
  */
12055
12086
  export declare type ɵImageConfig = {
12056
12087
  breakpoints?: number[];
12088
+ placeholderResolution?: number;
12057
12089
  disableImageSizeWarning?: boolean;
12058
12090
  disableImageLazyLoadWarning?: boolean;
12059
12091
  };
@@ -13008,13 +13040,16 @@ export declare function ɵtruncateMiddle(str: string, maxLength?: number): strin
13008
13040
  */
13009
13041
  export declare function ɵunregisterLocaleData(): void;
13010
13042
 
13011
- /** Unwraps all `InputSignal` class fields of the given directive. */
13043
+ /**
13044
+ * Unwraps all `InputSignal`/`InputSignalWithTransform` class fields of
13045
+ * the given directive.
13046
+ */
13012
13047
  export declare type ɵUnwrapDirectiveSignalInputs<Dir, Fields extends keyof Dir> = {
13013
13048
  [P in Fields]: ɵUnwrapInputSignalWriteType<Dir[P]>;
13014
13049
  };
13015
13050
 
13016
- /** Retrieves the `WriteT` of an `InputSignal`. */
13017
- declare type ɵUnwrapInputSignalWriteType<Field> = Field extends InputSignal<unknown, infer WriteT> ? WriteT : never;
13051
+ /** Retrieves the `WriteT` of an `InputSignal` and `InputSignalWithTransform`. */
13052
+ declare type ɵUnwrapInputSignalWriteType<Field> = Field extends InputSignalWithTransform<unknown, infer WriteT> ? WriteT : never;
13018
13053
 
13019
13054
  export declare function ɵunwrapSafeValue(value: ɵSafeValue): string;
13020
13055
 
@@ -13995,7 +14030,21 @@ export declare function ɵɵconditional<T>(containerIndex: number, matchingTempl
13995
14030
  *
13996
14031
  * @codeGenApi
13997
14032
  */
13998
- export declare function ɵɵcontentQuery<T>(directiveIndex: number, predicate: ProviderToken<unknown> | string[], flags: QueryFlags, read?: any): void;
14033
+ export declare function ɵɵcontentQuery<T>(directiveIndex: number, predicate: ProviderToken<unknown> | string | string[], flags: QueryFlags, read?: any): void;
14034
+
14035
+ /**
14036
+ * Registers a QueryList, associated with a content query, for later refresh (part of a view
14037
+ * refresh).
14038
+ *
14039
+ * @param directiveIndex Current directive index
14040
+ * @param predicate The type for which the query will search
14041
+ * @param flags Flags associated with the query
14042
+ * @param read What to save in the query
14043
+ * @returns QueryList<T>
14044
+ *
14045
+ * @codeGenApi
14046
+ */
14047
+ export declare function ɵɵcontentQuerySignal<T>(target: Signal<T>, directiveIndex: number, predicate: ProviderToken<unknown> | string[], flags: QueryFlags, read?: any): void;
13999
14048
 
14000
14049
  /**
14001
14050
  * Copies the fields not handled by the `ɵɵInheritDefinitionFeature` from the supertype of a
@@ -15647,6 +15696,20 @@ export declare function ɵɵpureFunction8(slotOffset: number, pureFn: (v1: any,
15647
15696
  */
15648
15697
  export declare function ɵɵpureFunctionV(slotOffset: number, pureFn: (...v: any[]) => any, exps: any[], thisArg?: any): any;
15649
15698
 
15699
+ /**
15700
+ * Advances the current query index by a specified offset.
15701
+ *
15702
+ * Adjusting the current query index is necessary in cases where a given directive has a mix of
15703
+ * zone-based and signal-based queries. The signal-based queries don't require tracking of the
15704
+ * current index (those are refreshed on demand and not during change detection) so this instruction
15705
+ * is only necessary for backward-compatibility.
15706
+ *
15707
+ * @param index offset to apply to the current query index (defaults to 1)
15708
+ *
15709
+ * @codeGenApi
15710
+ */
15711
+ export declare function ɵɵqueryAdvance(indexOffset?: number): void;
15712
+
15650
15713
  /**
15651
15714
  * Refreshes a query by combining matches from all active views and removing matches from deleted
15652
15715
  * views.
@@ -16901,7 +16964,7 @@ export declare function ɵɵtrustConstantResourceUrl(url: TemplateStringsArray):
16901
16964
  export declare function ɵɵvalidateIframeAttribute(attrValue: any, tagName: string, attrName: string): any;
16902
16965
 
16903
16966
  /**
16904
- * Creates new QueryList, stores the reference in LView and returns QueryList.
16967
+ * Creates a new view query by initializing internal data structures.
16905
16968
  *
16906
16969
  * @param predicate The type for which the query will search
16907
16970
  * @param flags Flags associated with the query
@@ -16909,6 +16972,19 @@ export declare function ɵɵvalidateIframeAttribute(attrValue: any, tagName: str
16909
16972
  *
16910
16973
  * @codeGenApi
16911
16974
  */
16912
- export declare function ɵɵviewQuery<T>(predicate: ProviderToken<unknown> | string[], flags: QueryFlags, read?: any): void;
16975
+ export declare function ɵɵviewQuery<T>(predicate: ProviderToken<unknown> | string | string[], flags: QueryFlags, read?: any): void;
16976
+
16977
+ /**
16978
+ * Creates a new view query by initializing internal data structures and binding a new query to the
16979
+ * target signal.
16980
+ *
16981
+ * @param target The target signal to assign the query results to.
16982
+ * @param predicate The type or label that should match a given query
16983
+ * @param flags Flags associated with the query
16984
+ * @param read What to save in the query
16985
+ *
16986
+ * @codeGenApi
16987
+ */
16988
+ export declare function ɵɵviewQuerySignal(target: Signal<unknown>, predicate: ProviderToken<unknown> | string[], flags: QueryFlags, read?: ProviderToken<unknown>): void;
16913
16989
 
16914
16990
  export { }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular/core",
3
- "version": "17.1.2",
3
+ "version": "17.2.0-next.1",
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.2.0-next.1
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -53,6 +53,8 @@ export declare function consumerBeforeComputation(node: ReactiveNode | null): Re
53
53
  */
54
54
  export declare function consumerDestroy(node: ReactiveNode): void;
55
55
 
56
+ export declare function consumerMarkDirty(node: ReactiveNode): void;
57
+
56
58
  /**
57
59
  * Determine whether this consumer has any dependencies which have changed since the last time
58
60
  * they were read.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v17.1.2
2
+ * @license Angular v17.2.0-next.1
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */