static-injector 6.4.0 → 7.0.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.
Files changed (52) hide show
  1. package/import/application/application_tokens.d.ts +58 -0
  2. package/import/application/stability_debug.d.ts +13 -0
  3. package/import/authoring/output/output_ref.d.ts +37 -0
  4. package/import/change_detection/scheduling/zoneless_scheduling.d.ts +0 -7
  5. package/import/core_reactivity_export_internal.d.ts +1 -1
  6. package/import/defer/idle_service.d.ts +42 -0
  7. package/import/di/create_injector.d.ts +2 -2
  8. package/import/di/forward_ref.d.ts +2 -2
  9. package/import/di/index.d.ts +4 -0
  10. package/import/di/inject_async.d.ts +91 -0
  11. package/import/di/injectable.d.ts +7 -1
  12. package/import/di/injection_token.d.ts +7 -0
  13. package/import/di/injector.d.ts +1 -1
  14. package/import/di/injector_compatibility.d.ts +0 -1
  15. package/import/di/interface/defs.d.ts +2 -2
  16. package/import/di/interface/provider.d.ts +0 -15
  17. package/import/document.d.ts +18 -0
  18. package/import/errors.d.ts +13 -9
  19. package/import/event_emitter.d.ts +101 -0
  20. package/import/hydration/cache.d.ts +14 -0
  21. package/import/index.d.ts +16 -0
  22. package/import/linker.d.ts +1 -0
  23. package/import/pending_tasks.d.ts +1 -24
  24. package/import/pending_tasks_internal.d.ts +31 -0
  25. package/import/render3/debug/injector_profiler.d.ts +10 -4
  26. package/import/render3/debug/special_providers.d.ts +17 -0
  27. package/import/render3/reactivity/api.d.ts +15 -0
  28. package/import/render3/reactivity/asserts.d.ts +1 -0
  29. package/import/render3/reactivity/effect.d.ts +3 -1
  30. package/import/render3/reactivity/root_effect_scheduler.d.ts +1 -1
  31. package/import/render3/reactivity/signal.d.ts +0 -4
  32. package/import/render3/util/stringify_utils.d.ts +1 -1
  33. package/import/resource/api.d.ts +101 -15
  34. package/import/resource/debounce.d.ts +21 -0
  35. package/import/resource/from_snapshots.d.ts +16 -0
  36. package/import/resource/index.d.ts +2 -0
  37. package/import/resource/resource.d.ts +32 -8
  38. package/import/transfer_state.d.ts +89 -0
  39. package/import/util/default_export.d.ts +24 -0
  40. package/import/util/promise_with_resolvers.d.ts +38 -0
  41. package/import/zone/ng_zone.d.ts +261 -0
  42. package/index.js +875 -196
  43. package/index.js.map +4 -4
  44. package/index.mjs +858 -190
  45. package/index.mjs.map +4 -4
  46. package/package.json +2 -2
  47. package/primitives/signals/index.d.ts +1 -1
  48. package/primitives/signals/src/formatter.d.ts +2 -1
  49. package/primitives/signals/src/graph.d.ts +8 -1
  50. package/primitives/signals/src/linked_signal.d.ts +1 -1
  51. package/readme.md +1 -1
  52. /package/import/{interface → change_detection}/lifecycle_hooks.d.ts +0 -0
@@ -0,0 +1,38 @@
1
+ /**
2
+ * @license
3
+ * Copyright Google LLC All Rights Reserved.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license that can be
6
+ * found in the LICENSE file at https://angular.dev/license
7
+ */
8
+ /**
9
+ * TODO(incremental-hydration): Remove this file entirely once PromiseWithResolvers lands in stable
10
+ * node / TS.
11
+ */
12
+ export interface PromiseWithResolvers<T> {
13
+ promise: Promise<T>;
14
+ resolve: (value: T | PromiseLike<T>) => void;
15
+ reject: (reason?: any) => void;
16
+ }
17
+ export interface PromiseConstructor {
18
+ /**
19
+ * Creates a new Promise and returns it in an object, along with its resolve and reject functions.
20
+ * @returns An object with the properties `promise`, `resolve`, and `reject`.
21
+ *
22
+ * ```ts
23
+ * const { promise, resolve, reject } = Promise.withResolvers<T>();
24
+ * ```
25
+ */
26
+ withResolvers<T>(): PromiseWithResolvers<T>;
27
+ }
28
+ /**
29
+ * Replace with `Promise.withResolvers()` once it's available.
30
+ * NET September 2026
31
+ *
32
+ * See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/withResolvers.
33
+ */
34
+ export declare function promiseWithResolvers<T>(): {
35
+ promise: Promise<T>;
36
+ resolve: (value: T | PromiseLike<T>) => void;
37
+ reject: (reason?: any) => void;
38
+ };
@@ -0,0 +1,261 @@
1
+ /**
2
+ * @license
3
+ * Copyright Google LLC All Rights Reserved.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license that can be
6
+ * found in the LICENSE file at https://angular.dev/license
7
+ */
8
+ import { EventEmitter } from '../event_emitter';
9
+ export declare const angularZoneInstanceIdProperty: string;
10
+ /**
11
+ * An injectable service for executing work inside or outside of the Angular zone.
12
+ *
13
+ * The most common use of this service is to optimize performance when starting a work consisting of
14
+ * one or more asynchronous tasks that don't require UI updates or error handling to be handled by
15
+ * Angular. Such tasks can be kicked off via {@link #runOutsideAngular} and if needed, these tasks
16
+ * can reenter the Angular zone via {@link #run}.
17
+ *
18
+ * <!-- TODO: add/fix links to:
19
+ * - docs explaining zones and the use of zones in Angular and change-detection
20
+ * - link to runOutsideAngular/run (throughout this file!)
21
+ * -->
22
+ *
23
+ * @usageNotes
24
+ * ### Example
25
+ *
26
+ * ```ts
27
+ * import {Component, NgZone} from '@angular/core';
28
+ *
29
+ * @Component({
30
+ * selector: 'ng-zone-demo',
31
+ * template: `
32
+ * <h2>Demo: NgZone</h2>
33
+ *
34
+ * <p>Progress: {{progress}}%</p>
35
+ * @if(progress >= 100) {
36
+ * <p>Done processing {{label}} of Angular zone!</p>
37
+ * }
38
+ *
39
+ * <button (click)="processWithinAngularZone()">Process within Angular zone</button>
40
+ * <button (click)="processOutsideOfAngularZone()">Process outside of Angular zone</button>
41
+ * `,
42
+ * })
43
+ * export class NgZoneDemo {
44
+ * progress: number = 0;
45
+ * label: string;
46
+ *
47
+ * constructor(private _ngZone: NgZone) {}
48
+ *
49
+ * // Loop inside the Angular zone
50
+ * // so the UI DOES refresh after each setTimeout cycle
51
+ * processWithinAngularZone() {
52
+ * this.label = 'inside';
53
+ * this.progress = 0;
54
+ * this._increaseProgress(() => console.log('Inside Done!'));
55
+ * }
56
+ *
57
+ * // Loop outside of the Angular zone
58
+ * // so the UI DOES NOT refresh after each setTimeout cycle
59
+ * processOutsideOfAngularZone() {
60
+ * this.label = 'outside';
61
+ * this.progress = 0;
62
+ * this._ngZone.runOutsideAngular(() => {
63
+ * this._increaseProgress(() => {
64
+ * // reenter the Angular zone and display done
65
+ * this._ngZone.run(() => { console.log('Outside Done!'); });
66
+ * });
67
+ * });
68
+ * }
69
+ *
70
+ * _increaseProgress(doneCallback: () => void) {
71
+ * this.progress += 1;
72
+ * console.log(`Current progress: ${this.progress}%`);
73
+ *
74
+ * if (this.progress < 100) {
75
+ * window.setTimeout(() => this._increaseProgress(doneCallback), 10);
76
+ * } else {
77
+ * doneCallback();
78
+ * }
79
+ * }
80
+ * }
81
+ * ```
82
+ *
83
+ * @see [Resolving zone pollution](best-practices/zone-pollution#run-tasks-outside-ngzone)
84
+ *
85
+ * @publicApi
86
+ */
87
+ export declare class NgZone {
88
+ readonly hasPendingMacrotasks: boolean;
89
+ readonly hasPendingMicrotasks: boolean;
90
+ /**
91
+ * Whether there are no outstanding microtasks or macrotasks.
92
+ */
93
+ readonly isStable: boolean;
94
+ /**
95
+ * Notifies when code enters Angular Zone. This gets fired first on VM Turn.
96
+ */
97
+ readonly onUnstable: EventEmitter<any>;
98
+ /**
99
+ * Notifies when there is no more microtasks enqueued in the current VM Turn.
100
+ * This is a hint for Angular to do change detection, which may enqueue more microtasks.
101
+ * For this reason this event can fire multiple times per VM Turn.
102
+ */
103
+ readonly onMicrotaskEmpty: EventEmitter<any>;
104
+ /**
105
+ * Notifies when the last `onMicrotaskEmpty` has run and there are no more microtasks, which
106
+ * implies we are about to relinquish VM turn.
107
+ * This event gets called just once.
108
+ */
109
+ readonly onStable: EventEmitter<any>;
110
+ /**
111
+ * Notifies that an error has been delivered.
112
+ */
113
+ readonly onError: EventEmitter<any>;
114
+ constructor(options: {
115
+ enableLongStackTrace?: boolean;
116
+ shouldCoalesceEventChangeDetection?: boolean;
117
+ shouldCoalesceRunChangeDetection?: boolean;
118
+ });
119
+ /**
120
+ This method checks whether the method call happens within an Angular Zone instance.
121
+ */
122
+ /**
123
+ Assures that the method is called within the Angular Zone, otherwise throws an error.
124
+ */
125
+ /**
126
+ Assures that the method is called outside of the Angular Zone, otherwise throws an error.
127
+ */
128
+ /**
129
+ * Executes the `fn` function synchronously within the Angular zone and returns value returned by
130
+ * the function.
131
+ *
132
+ * Running functions via `run` allows you to reenter Angular zone from a task that was executed
133
+ * outside of the Angular zone (typically started via {@link #runOutsideAngular}).
134
+ *
135
+ * Any future tasks or microtasks scheduled from within this function will continue executing from
136
+ * within the Angular zone.
137
+ *
138
+ * If a synchronous error happens it will be rethrown and not reported via `onError`.
139
+ */
140
+ run<T>(fn: (...args: any[]) => T, applyThis?: any, applyArgs?: any[]): T;
141
+ /**
142
+ * Executes the `fn` function synchronously within the Angular zone as a task and returns value
143
+ * returned by the function.
144
+ *
145
+ * Running functions via `runTask` allows you to reenter Angular zone from a task that was executed
146
+ * outside of the Angular zone (typically started via {@link #runOutsideAngular}).
147
+ *
148
+ * Any future tasks or microtasks scheduled from within this function will continue executing from
149
+ * within the Angular zone.
150
+ *
151
+ * If a synchronous error happens it will be rethrown and not reported via `onError`.
152
+ */
153
+ runTask<T>(fn: (...args: any[]) => T, applyThis?: any, applyArgs?: any[], name?: string): T;
154
+ /**
155
+ * Same as `run`, except that synchronous errors are caught and forwarded via `onError` and not
156
+ * rethrown.
157
+ */
158
+ runGuarded<T>(fn: (...args: any[]) => T, applyThis?: any, applyArgs?: any[]): T;
159
+ /**
160
+ * Executes the `fn` function synchronously in Angular's parent zone and returns value returned by
161
+ * the function.
162
+ *
163
+ * Running functions via {@link #runOutsideAngular} allows you to escape Angular's zone and do
164
+ * work that
165
+ * doesn't trigger Angular change-detection or is subject to Angular's error handling.
166
+ *
167
+ * Any future tasks or microtasks scheduled from within this function will continue executing from
168
+ * outside of the Angular zone.
169
+ *
170
+ * Use {@link #run} to reenter the Angular zone and do work that updates the application model.
171
+ */
172
+ runOutsideAngular<T>(fn: (...args: any[]) => T): T; /** @nocollapse */
173
+ static ɵprov /**
174
+ @pureOrBreakMyCode */: import("../di/interface/defs").ɵɵInjectableDeclaration<NoopNgZone>;
175
+ }
176
+ export interface NgZonePrivate extends NgZone {
177
+ _outer: Zone;
178
+ _inner: Zone;
179
+ _nesting: number;
180
+ _hasPendingMicrotasks: boolean;
181
+ hasPendingMacrotasks: boolean;
182
+ hasPendingMicrotasks: boolean;
183
+ callbackScheduled: boolean;
184
+ /**
185
+ * A flag to indicate if NgZone is currently inside
186
+ * checkStable and to prevent re-entry. The flag is
187
+ * needed because it is possible to invoke the change
188
+ * detection from within change detection leading to
189
+ * incorrect behavior.
190
+ *
191
+ * For detail, please refer here,
192
+ * https://github.com/angular/angular/pull/40540
193
+ */
194
+ isCheckStableRunning: boolean;
195
+ isStable: boolean;
196
+ /**
197
+ * Optionally specify coalescing event change detections or not.
198
+ * Consider the following case.
199
+ *
200
+ * <div (click)="doSomething()">
201
+ * <button (click)="doSomethingElse()"></button>
202
+ * </div>
203
+ *
204
+ * When button is clicked, because of the event bubbling, both
205
+ * event handlers will be called and 2 change detections will be
206
+ * triggered. We can coalesce such kind of events to trigger
207
+ * change detection only once.
208
+ *
209
+ * By default, this option will be false. So the events will not be
210
+ * coalesced and the change detection will be triggered multiple times.
211
+ * And if this option be set to true, the change detection will be
212
+ * triggered async by scheduling it in an animation frame. So in the case above,
213
+ * the change detection will only be trigged once.
214
+ */
215
+ shouldCoalesceEventChangeDetection: boolean;
216
+ /**
217
+ * Optionally specify if `NgZone#run()` method invocations should be coalesced
218
+ * into a single change detection.
219
+ *
220
+ * Consider the following case.
221
+ *
222
+ * for (let i = 0; i < 10; i ++) {
223
+ * ngZone.run(() => {
224
+ * // do something
225
+ * });
226
+ * }
227
+ *
228
+ * This case triggers the change detection multiple times.
229
+ * With ngZoneRunCoalescing options, all change detections in an event loops trigger only once.
230
+ * In addition, the change detection executes in requestAnimation.
231
+ *
232
+ */
233
+ shouldCoalesceRunChangeDetection: boolean;
234
+ /**
235
+ * Whether to schedule the coalesced change detection in the root zone
236
+ */
237
+ scheduleInRootZone: boolean;
238
+ }
239
+ /**
240
+ * Provides a noop implementation of `NgZone` which does nothing. This zone requires explicit calls
241
+ * to framework to perform rendering.
242
+ */
243
+ export declare class NoopNgZone implements NgZone {
244
+ readonly hasPendingMicrotasks = false;
245
+ readonly hasPendingMacrotasks = false;
246
+ readonly isStable = true;
247
+ readonly onUnstable: EventEmitter<any>;
248
+ readonly onMicrotaskEmpty: EventEmitter<any>;
249
+ readonly onStable: EventEmitter<any>;
250
+ readonly onError: EventEmitter<any>;
251
+ run<T>(fn: (...args: any[]) => T, applyThis?: any, applyArgs?: any): T;
252
+ runGuarded<T>(fn: (...args: any[]) => any, applyThis?: any, applyArgs?: any): T;
253
+ runOutsideAngular<T>(fn: (...args: any[]) => T): T;
254
+ runTask<T>(fn: (...args: any[]) => T, applyThis?: any, applyArgs?: any, name?: string): T;
255
+ }
256
+ export interface InternalNgZoneOptions {
257
+ enableLongStackTrace?: boolean;
258
+ shouldCoalesceEventChangeDetection?: boolean;
259
+ shouldCoalesceRunChangeDetection?: boolean;
260
+ scheduleInRootZone?: boolean;
261
+ }