@angular/core 15.2.0-rc.0 → 16.0.0-next.0
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.
- package/esm2020/src/core.mjs +2 -1
- package/esm2020/src/core_reactivity_export.mjs +11 -0
- package/esm2020/src/core_reactivity_export_internal.mjs +9 -0
- package/esm2020/src/di/interface/defs.mjs +4 -5
- package/esm2020/src/di/provider_collection.mjs +2 -2
- package/esm2020/src/metadata/directives.mjs +1 -1
- package/esm2020/src/render/api_flags.mjs +1 -1
- package/esm2020/src/signals/index.mjs +15 -0
- package/esm2020/src/signals/src/api.mjs +46 -0
- package/esm2020/src/signals/src/computed.mjs +142 -0
- package/esm2020/src/signals/src/effect.mjs +69 -0
- package/esm2020/src/signals/src/graph.mjs +114 -0
- package/esm2020/src/signals/src/signal.mjs +78 -0
- package/esm2020/src/signals/src/untracked.mjs +26 -0
- package/esm2020/src/signals/src/watch.mjs +54 -0
- package/esm2020/src/signals/src/weak_ref.mjs +11 -0
- package/esm2020/src/version.mjs +1 -1
- package/esm2020/testing/src/logger.mjs +3 -3
- package/esm2020/testing/src/ng_zone_mock.mjs +3 -3
- package/fesm2015/core.mjs +483 -7
- package/fesm2015/core.mjs.map +1 -1
- package/fesm2015/testing.mjs +5 -6
- package/fesm2015/testing.mjs.map +1 -1
- package/fesm2020/core.mjs +481 -7
- package/fesm2020/core.mjs.map +1 -1
- package/fesm2020/testing.mjs +5 -6
- package/fesm2020/testing.mjs.map +1 -1
- package/index.d.ts +287 -3
- package/package.json +1 -1
- package/schematics/ng-generate/standalone-migration/bundle.js +608 -804
- package/schematics/ng-generate/standalone-migration/bundle.js.map +4 -4
- package/testing/index.d.ts +1 -1
- package/esm2020/src/view/index.mjs +0 -9
package/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular
|
|
2
|
+
* @license Angular v16.0.0-next.0
|
|
3
3
|
* (c) 2010-2022 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -1417,6 +1417,13 @@ declare type ComponentTemplate<T> = {
|
|
|
1417
1417
|
<U extends T>(rf: ɵRenderFlags, ctx: T | U): void;
|
|
1418
1418
|
};
|
|
1419
1419
|
|
|
1420
|
+
/**
|
|
1421
|
+
* Create a computed `Signal` which derives a reactive value from an expression.
|
|
1422
|
+
*
|
|
1423
|
+
* @developerPreview
|
|
1424
|
+
*/
|
|
1425
|
+
export declare function computed<T>(computation: () => T, equal?: ValueEqualityFn<T>): Signal<T>;
|
|
1426
|
+
|
|
1420
1427
|
/**
|
|
1421
1428
|
* Configures the `Injector` to return an instance of a token.
|
|
1422
1429
|
*
|
|
@@ -1465,6 +1472,78 @@ export declare interface ConstructorSansProvider {
|
|
|
1465
1472
|
deps?: any[];
|
|
1466
1473
|
}
|
|
1467
1474
|
|
|
1475
|
+
/**
|
|
1476
|
+
* Represents a reader that can depend on reactive values (`Producer`s) and receive
|
|
1477
|
+
* notifications when those values change.
|
|
1478
|
+
*
|
|
1479
|
+
* `Consumer`s do not wrap the reads they consume themselves, but rather can be set
|
|
1480
|
+
* as the active reader via `setActiveConsumer`.
|
|
1481
|
+
*
|
|
1482
|
+
* The set of dependencies of a `Consumer` is dynamic. Implementers expose a
|
|
1483
|
+
* monotonically increasing `trackingVersion` counter, which increments whenever
|
|
1484
|
+
* the `Consumer` is about to re-run any reactive reads it needs and establish a
|
|
1485
|
+
* new set of dependencies as a result.
|
|
1486
|
+
*
|
|
1487
|
+
* `Producer`s store the last `trackingVersion` they've seen from `Consumer`s which
|
|
1488
|
+
* have read them. This allows a `Producer` to identify whether its record of the
|
|
1489
|
+
* dependency is current or stale, by comparing the `Consumer`'s `trackingVersion`
|
|
1490
|
+
* to the version at which the dependency was established.
|
|
1491
|
+
*/
|
|
1492
|
+
declare interface Consumer {
|
|
1493
|
+
/**
|
|
1494
|
+
* Numeric identifier of this `Producer`.
|
|
1495
|
+
*
|
|
1496
|
+
* May also be used to satisfy the interface for `Producer`.
|
|
1497
|
+
*/
|
|
1498
|
+
readonly id: ConsumerId;
|
|
1499
|
+
/**
|
|
1500
|
+
* A `WeakRef` to this `Consumer` instance.
|
|
1501
|
+
*
|
|
1502
|
+
* An implementer provides this as a cached value to avoid the need to instantiate
|
|
1503
|
+
* multiple `WeakRef` instances for the same `Consumer`.
|
|
1504
|
+
*
|
|
1505
|
+
* May also be used to satisfy the interface for `Producer`.
|
|
1506
|
+
*/
|
|
1507
|
+
readonly ref: WeakRef<Consumer>;
|
|
1508
|
+
/**
|
|
1509
|
+
* A map of `Edge`s to `Producer` dependencies, keyed by the `ProducerId`.
|
|
1510
|
+
*
|
|
1511
|
+
* Used to poll `Producer`s to determine if the `Consumer` has really updated
|
|
1512
|
+
* or not.
|
|
1513
|
+
*/
|
|
1514
|
+
readonly producers: Map<ProducerId, Edge>;
|
|
1515
|
+
/**
|
|
1516
|
+
* Monotonically increasing counter representing a version of this `Consumer`'s
|
|
1517
|
+
* dependencies.
|
|
1518
|
+
*/
|
|
1519
|
+
readonly trackingVersion: number;
|
|
1520
|
+
/**
|
|
1521
|
+
* Called when a `Producer` dependency of this `Consumer` indicates it may
|
|
1522
|
+
* have a new value.
|
|
1523
|
+
*
|
|
1524
|
+
* Notification alone does not mean the `Producer` has definitely produced a
|
|
1525
|
+
* semantically different value, only that it _may_ have changed. Before a
|
|
1526
|
+
* `Consumer` re-runs any computations or side effects, it should use the
|
|
1527
|
+
* `consumerPollValueStatus` method to poll the `Producer`s on which it depends
|
|
1528
|
+
* and determine if any of them have actually updated.
|
|
1529
|
+
*/
|
|
1530
|
+
notify(): void;
|
|
1531
|
+
}
|
|
1532
|
+
|
|
1533
|
+
/**
|
|
1534
|
+
* Identifier for a `Consumer`, which is a branded `number`.
|
|
1535
|
+
*
|
|
1536
|
+
* Note that `ProducerId` and `ConsumerId` are assigned from the same sequence, so the same `number`
|
|
1537
|
+
* will never be used for both.
|
|
1538
|
+
*
|
|
1539
|
+
* Branding provides additional type safety by ensuring that `ProducerId` and `ConsumerId` are
|
|
1540
|
+
* mutually unassignable without a cast. Since several `Map`s are keyed by these IDs, this prevents
|
|
1541
|
+
* `ConsumerId`s from being inadvertently used to look up `Producer`s or vice versa.
|
|
1542
|
+
*/
|
|
1543
|
+
declare type ConsumerId = number & {
|
|
1544
|
+
__consumer: true;
|
|
1545
|
+
};
|
|
1546
|
+
|
|
1468
1547
|
/**
|
|
1469
1548
|
* Type of the ContentChild metadata.
|
|
1470
1549
|
*
|
|
@@ -2210,7 +2289,7 @@ export declare interface Directive {
|
|
|
2210
2289
|
* ```typescript
|
|
2211
2290
|
* @Component({
|
|
2212
2291
|
* selector: 'child-dir',
|
|
2213
|
-
* outputs: [ 'bankNameChange' ]
|
|
2292
|
+
* outputs: [ 'bankNameChange' ],
|
|
2214
2293
|
* template: `<input (input)="bankNameChange.emit($event.target.value)" />`
|
|
2215
2294
|
* })
|
|
2216
2295
|
* class ChildDir {
|
|
@@ -2543,6 +2622,61 @@ export declare interface DoCheck {
|
|
|
2543
2622
|
ngDoCheck(): void;
|
|
2544
2623
|
}
|
|
2545
2624
|
|
|
2625
|
+
/**
|
|
2626
|
+
* A bidirectional edge in the producer-consumer dependency graph.
|
|
2627
|
+
*/
|
|
2628
|
+
declare interface Edge {
|
|
2629
|
+
/**
|
|
2630
|
+
* Weakly held reference to the `Consumer` side of this edge.
|
|
2631
|
+
*/
|
|
2632
|
+
readonly consumerRef: WeakRef<Consumer>;
|
|
2633
|
+
/**
|
|
2634
|
+
* Weakly held reference to the `Producer` side of this edge.
|
|
2635
|
+
*/
|
|
2636
|
+
readonly producerRef: WeakRef<Producer>;
|
|
2637
|
+
/**
|
|
2638
|
+
* `trackingVersion` of the `Consumer` at which this dependency edge was last observed.
|
|
2639
|
+
*
|
|
2640
|
+
* If this doesn't match the `Consumer`'s current `trackingVersion`, then this dependency record
|
|
2641
|
+
* is stale, and needs to be cleaned up.
|
|
2642
|
+
*/
|
|
2643
|
+
atTrackingVersion: number;
|
|
2644
|
+
/**
|
|
2645
|
+
* `valueVersion` of the `Producer` at the time this dependency was last accessed.
|
|
2646
|
+
*
|
|
2647
|
+
* This is used by `consumerPollValueStatus` to determine whether a `Consumer`'s dependencies have
|
|
2648
|
+
* semantically changed.
|
|
2649
|
+
*/
|
|
2650
|
+
seenValueVersion: number;
|
|
2651
|
+
}
|
|
2652
|
+
|
|
2653
|
+
/**
|
|
2654
|
+
* A global reactive effect, which can be manually scheduled or destroyed.
|
|
2655
|
+
*
|
|
2656
|
+
* @developerPreview
|
|
2657
|
+
*/
|
|
2658
|
+
export declare interface Effect {
|
|
2659
|
+
/**
|
|
2660
|
+
* Schedule the effect for manual execution, if it's not already.
|
|
2661
|
+
*/
|
|
2662
|
+
schedule(): void;
|
|
2663
|
+
/**
|
|
2664
|
+
* Shut down the effect, removing it from any upcoming scheduled executions.
|
|
2665
|
+
*/
|
|
2666
|
+
destroy(): void;
|
|
2667
|
+
/**
|
|
2668
|
+
* Direct access to the effect's `Consumer` for advanced use cases.
|
|
2669
|
+
*/
|
|
2670
|
+
readonly consumer: Consumer;
|
|
2671
|
+
}
|
|
2672
|
+
|
|
2673
|
+
/**
|
|
2674
|
+
* Create a global `Effect` for the given reactive function.
|
|
2675
|
+
*
|
|
2676
|
+
* @developerPreview
|
|
2677
|
+
*/
|
|
2678
|
+
export declare function effect(effectFn: () => void): Effect;
|
|
2679
|
+
|
|
2546
2680
|
/**
|
|
2547
2681
|
* Marks that the next string is an element name.
|
|
2548
2682
|
*
|
|
@@ -4246,6 +4380,11 @@ declare interface InternalViewRef extends ViewRef {
|
|
|
4246
4380
|
*/
|
|
4247
4381
|
export declare function isDevMode(): boolean;
|
|
4248
4382
|
|
|
4383
|
+
/**
|
|
4384
|
+
* Checks if the given `value` function is a reactive `Signal`.
|
|
4385
|
+
*/
|
|
4386
|
+
export declare function isSignal(value: Function): value is Signal<unknown>;
|
|
4387
|
+
|
|
4249
4388
|
/**
|
|
4250
4389
|
* Checks whether a given Component, Directive or Pipe is marked as standalone.
|
|
4251
4390
|
* This will return false if passed anything other than a Component, Directive, or Pipe class
|
|
@@ -5934,6 +6073,74 @@ declare const enum PreOrderHookFlags {
|
|
|
5934
6073
|
*/
|
|
5935
6074
|
declare type ProcessProvidersFunction = (providers: Provider[]) => Provider[];
|
|
5936
6075
|
|
|
6076
|
+
/**
|
|
6077
|
+
* Represents a value that can be read reactively, and can notify readers (`Consumer`s)
|
|
6078
|
+
* when it changes.
|
|
6079
|
+
*
|
|
6080
|
+
* Producers maintain a weak reference to any `Consumer`s which may depend on the
|
|
6081
|
+
* producer's value.
|
|
6082
|
+
*
|
|
6083
|
+
* Implementers of `Producer` expose a monotonic `valueVersion` counter, and are responsible
|
|
6084
|
+
* for incrementing this version when their value semantically changes. Some Producers may
|
|
6085
|
+
* produce this value lazily and thus at times need to be polled for potential updates to
|
|
6086
|
+
* their value (and by extension their `valueVersion`). This is accomplished via the
|
|
6087
|
+
* `checkForChangedValue` method for Producers, which should perform whatever calculations
|
|
6088
|
+
* are necessary to ensure `valueVersion` is up to date.
|
|
6089
|
+
*
|
|
6090
|
+
* `Producer`s support two operations:
|
|
6091
|
+
* * `producerNotifyConsumers`
|
|
6092
|
+
* * `producerAccessed`
|
|
6093
|
+
*/
|
|
6094
|
+
declare interface Producer {
|
|
6095
|
+
/**
|
|
6096
|
+
* Numeric identifier of this `Producer`.
|
|
6097
|
+
*
|
|
6098
|
+
* May also be used to satisfy the interface for `Consumer`.
|
|
6099
|
+
*/
|
|
6100
|
+
readonly id: ProducerId;
|
|
6101
|
+
/**
|
|
6102
|
+
* A `WeakRef` to this `Producer` instance.
|
|
6103
|
+
*
|
|
6104
|
+
* An implementer provides this as a cached value to avoid the need to instantiate
|
|
6105
|
+
* multiple `WeakRef` instances for the same `Producer`.
|
|
6106
|
+
*
|
|
6107
|
+
* May also be used to satisfy the interface for `Consumer`.
|
|
6108
|
+
*/
|
|
6109
|
+
readonly ref: WeakRef<Producer>;
|
|
6110
|
+
/**
|
|
6111
|
+
* A map of dependency `Edge`s to `Consumer`s, keyed by the `ConsumerId`.
|
|
6112
|
+
*
|
|
6113
|
+
* Used when the produced value changes to notify interested `Consumer`s.
|
|
6114
|
+
*/
|
|
6115
|
+
readonly consumers: Map<ConsumerId, Edge>;
|
|
6116
|
+
/**
|
|
6117
|
+
* Monotonically increasing counter which increases when the value of this `Producer`
|
|
6118
|
+
* semantically changes.
|
|
6119
|
+
*/
|
|
6120
|
+
readonly valueVersion: number;
|
|
6121
|
+
/**
|
|
6122
|
+
* Ensure that `valueVersion` is up to date for the `Producer`'s value.
|
|
6123
|
+
*
|
|
6124
|
+
* Some `Producer`s may produce values lazily, and thus require polling before their
|
|
6125
|
+
* `valueVersion` can be compared with the version captured during a previous read.
|
|
6126
|
+
*/
|
|
6127
|
+
checkForChangedValue(): void;
|
|
6128
|
+
}
|
|
6129
|
+
|
|
6130
|
+
/**
|
|
6131
|
+
* Identifier for a `Producer`, which is a branded `number`.
|
|
6132
|
+
*
|
|
6133
|
+
* Note that `ProducerId` and `ConsumerId` are assigned from the same sequence, so the same `number`
|
|
6134
|
+
* will never be used for both.
|
|
6135
|
+
*
|
|
6136
|
+
* Branding provides additional type safety by ensuring that `ProducerId` and `ConsumerId` are
|
|
6137
|
+
* mutually unassignable without a cast. Since several `Map`s are keyed by these IDs, this prevents
|
|
6138
|
+
* `ProducerId`s from being inadvertently used to look up `Consumer`s or vice versa.
|
|
6139
|
+
*/
|
|
6140
|
+
declare type ProducerId = number & {
|
|
6141
|
+
__producer: true;
|
|
6142
|
+
};
|
|
6143
|
+
|
|
5937
6144
|
/**
|
|
5938
6145
|
* List of slots for a projection. A slot can be either based on a parsed CSS selector
|
|
5939
6146
|
* which will be used to determine nodes which are projected into that slot.
|
|
@@ -6991,7 +7198,7 @@ export declare interface RendererType2 {
|
|
|
6991
7198
|
/**
|
|
6992
7199
|
* Defines CSS styles to be stored on a renderer instance.
|
|
6993
7200
|
*/
|
|
6994
|
-
styles:
|
|
7201
|
+
styles: string[];
|
|
6995
7202
|
/**
|
|
6996
7203
|
* Defines arbitrary developer-defined data to be stored on a renderer instance.
|
|
6997
7204
|
* This is useful for renderers that delegate to other renderers.
|
|
@@ -7288,12 +7495,62 @@ export declare interface SelfDecorator {
|
|
|
7288
7495
|
new (): Self;
|
|
7289
7496
|
}
|
|
7290
7497
|
|
|
7498
|
+
/**
|
|
7499
|
+
* A `Signal` with a value that can be mutated via a setter interface.
|
|
7500
|
+
*
|
|
7501
|
+
* @developerPreview
|
|
7502
|
+
*/
|
|
7503
|
+
export declare interface SettableSignal<T> extends Signal<T> {
|
|
7504
|
+
/**
|
|
7505
|
+
* Directly set the signal to a new value, and notify any dependents.
|
|
7506
|
+
*/
|
|
7507
|
+
set(value: T): void;
|
|
7508
|
+
/**
|
|
7509
|
+
* Update the value of the signal based on its current value, and
|
|
7510
|
+
* notify any dependents.
|
|
7511
|
+
*/
|
|
7512
|
+
update(updateFn: (value: T) => T): void;
|
|
7513
|
+
/**
|
|
7514
|
+
* Update the current value by mutating it in-place, and
|
|
7515
|
+
* notify any dependents.
|
|
7516
|
+
*/
|
|
7517
|
+
mutate(mutatorFn: (value: T) => void): void;
|
|
7518
|
+
}
|
|
7519
|
+
|
|
7291
7520
|
/**
|
|
7292
7521
|
* Set the {@link GetTestability} implementation used by the Angular testing framework.
|
|
7293
7522
|
* @publicApi
|
|
7294
7523
|
*/
|
|
7295
7524
|
export declare function setTestabilityGetter(getter: GetTestability): void;
|
|
7296
7525
|
|
|
7526
|
+
/**
|
|
7527
|
+
* Symbol used to tell `Signal`s apart from other functions.
|
|
7528
|
+
*
|
|
7529
|
+
* This can be used to auto-unwrap signals in various cases, or to auto-wrap non-signal values.
|
|
7530
|
+
*/
|
|
7531
|
+
declare const SIGNAL: unique symbol;
|
|
7532
|
+
|
|
7533
|
+
/**
|
|
7534
|
+
* A reactive value which notifies consumers of any changes.
|
|
7535
|
+
*
|
|
7536
|
+
* Signals are functions which returns their current value. To access the current value of a signal,
|
|
7537
|
+
* call it.
|
|
7538
|
+
*
|
|
7539
|
+
* Ordinary values can be turned into `Signal`s with the `signal` function.
|
|
7540
|
+
*
|
|
7541
|
+
* @developerPreview
|
|
7542
|
+
*/
|
|
7543
|
+
export declare type Signal<T> = (() => T) & {
|
|
7544
|
+
[SIGNAL]: true;
|
|
7545
|
+
};
|
|
7546
|
+
|
|
7547
|
+
/**
|
|
7548
|
+
* Create a `Signal` that can be set or updated directly.
|
|
7549
|
+
*
|
|
7550
|
+
* @developerPreview
|
|
7551
|
+
*/
|
|
7552
|
+
export declare function signal<T>(initialValue: T, equal?: ValueEqualityFn<T>): SettableSignal<T>;
|
|
7553
|
+
|
|
7297
7554
|
|
|
7298
7555
|
/**
|
|
7299
7556
|
* Represents a basic change from a previous to a new value for a single
|
|
@@ -9004,6 +9261,22 @@ declare type TypeOrFactory<T> = T | (() => T);
|
|
|
9004
9261
|
export declare interface TypeProvider extends Type<any> {
|
|
9005
9262
|
}
|
|
9006
9263
|
|
|
9264
|
+
|
|
9265
|
+
/**
|
|
9266
|
+
* Execute an arbitrary function in a non-reactive (non-tracking) context. The executed function
|
|
9267
|
+
* can, optionally, return a value.
|
|
9268
|
+
*
|
|
9269
|
+
* @developerPreview
|
|
9270
|
+
*/
|
|
9271
|
+
export declare function untracked<T>(nonReactiveReadsFn: () => T): T;
|
|
9272
|
+
|
|
9273
|
+
/**
|
|
9274
|
+
* A comparison function which can determine if two values are equal.
|
|
9275
|
+
*
|
|
9276
|
+
* @developerPreview
|
|
9277
|
+
*/
|
|
9278
|
+
export declare type ValueEqualityFn<T> = (a: T, b: T) => boolean;
|
|
9279
|
+
|
|
9007
9280
|
/**
|
|
9008
9281
|
* Configures the `Injector` to return a value for a token.
|
|
9009
9282
|
* @see ["Dependency Injection Guide"](guide/dependency-injection).
|
|
@@ -9478,6 +9751,17 @@ declare interface ViewRefTracker {
|
|
|
9478
9751
|
detachView(viewRef: ViewRef): void;
|
|
9479
9752
|
}
|
|
9480
9753
|
|
|
9754
|
+
|
|
9755
|
+
declare interface WeakRef<T extends object> {
|
|
9756
|
+
deref(): T | undefined;
|
|
9757
|
+
}
|
|
9758
|
+
|
|
9759
|
+
declare const WeakRef: WeakRefCtor;
|
|
9760
|
+
|
|
9761
|
+
declare interface WeakRefCtor {
|
|
9762
|
+
new <T extends object>(value: T): WeakRef<T>;
|
|
9763
|
+
}
|
|
9764
|
+
|
|
9481
9765
|
/**
|
|
9482
9766
|
* Sanitizes the given unsafe, untrusted HTML fragment, and returns HTML text that is safe to add to
|
|
9483
9767
|
* the DOM in a browser environment.
|