@angular/core 18.0.0 → 18.1.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.
Files changed (52) hide show
  1. package/esm2022/primitives/event-dispatch/index.mjs +3 -2
  2. package/esm2022/primitives/event-dispatch/src/action_resolver.mjs +51 -35
  3. package/esm2022/primitives/event-dispatch/src/dispatcher.mjs +5 -4
  4. package/esm2022/primitives/event-dispatch/src/event.mjs +3 -7
  5. package/esm2022/primitives/event-dispatch/src/event_dispatcher.mjs +130 -0
  6. package/esm2022/primitives/event-dispatch/src/event_type.mjs +85 -1
  7. package/esm2022/primitives/event-dispatch/src/eventcontract.mjs +5 -8
  8. package/esm2022/src/application/create_application.mjs +8 -3
  9. package/esm2022/src/change_detection/scheduling/ng_zone_scheduling.mjs +4 -11
  10. package/esm2022/src/change_detection/scheduling/zoneless_scheduling_impl.mjs +2 -2
  11. package/esm2022/src/core_private_export.mjs +2 -1
  12. package/esm2022/src/core_render3_private_export.mjs +1 -1
  13. package/esm2022/src/error_details_base_url.mjs +2 -2
  14. package/esm2022/src/errors.mjs +1 -1
  15. package/esm2022/src/hydration/annotate.mjs +11 -6
  16. package/esm2022/src/hydration/event_replay.mjs +23 -26
  17. package/esm2022/src/image_performance_warning.mjs +3 -3
  18. package/esm2022/src/linker/view_ref.mjs +2 -2
  19. package/esm2022/src/platform/platform_ref.mjs +10 -3
  20. package/esm2022/src/render3/component_ref.mjs +1 -1
  21. package/esm2022/src/render3/hooks.mjs +1 -1
  22. package/esm2022/src/render3/instructions/listener.mjs +4 -7
  23. package/esm2022/src/render3/instructions/shared.mjs +1 -1
  24. package/esm2022/src/render3/node_manipulation.mjs +1 -1
  25. package/esm2022/src/render3/profiler.mjs +1 -1
  26. package/esm2022/src/render3/profiler_types.mjs +9 -0
  27. package/esm2022/src/version.mjs +1 -1
  28. package/esm2022/testing/src/logger.mjs +3 -3
  29. package/esm2022/testing/src/test_bed_compiler.mjs +7 -3
  30. package/fesm2022/core.mjs +231 -230
  31. package/fesm2022/core.mjs.map +1 -1
  32. package/fesm2022/primitives/event-dispatch.mjs +1402 -1188
  33. package/fesm2022/primitives/event-dispatch.mjs.map +1 -1
  34. package/fesm2022/primitives/signals.mjs +1 -1
  35. package/fesm2022/rxjs-interop.mjs +1 -1
  36. package/fesm2022/testing.mjs +7 -3
  37. package/fesm2022/testing.mjs.map +1 -1
  38. package/index.d.ts +43 -7
  39. package/package.json +1 -1
  40. package/primitives/event-dispatch/index.d.ts +45 -117
  41. package/primitives/signals/index.d.ts +1 -1
  42. package/rxjs-interop/index.d.ts +1 -1
  43. package/schematics/migrations/http-providers/bundle.js +1 -1
  44. package/schematics/migrations/http-providers/bundle.js.map +2 -2
  45. package/schematics/migrations/invalid-two-way-bindings/bundle.js +4 -2
  46. package/schematics/migrations/invalid-two-way-bindings/bundle.js.map +2 -2
  47. package/schematics/ng-generate/control-flow-migration/bundle.js +5 -3
  48. package/schematics/ng-generate/control-flow-migration/bundle.js.map +2 -2
  49. package/schematics/ng-generate/standalone-migration/bundle.js +47 -21
  50. package/schematics/ng-generate/standalone-migration/bundle.js.map +2 -2
  51. package/testing/index.d.ts +1 -1
  52. package/esm2022/src/change_detection/scheduling/flags.mjs +0 -10
package/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v18.0.0
2
+ * @license Angular v18.1.0-next.0
3
3
  * (c) 2010-2024 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -14,6 +14,7 @@ import { SignalNode } from '@angular/core/primitives/signals';
14
14
  import { Subject } from 'rxjs';
15
15
  import { Subscribable } from 'rxjs';
16
16
  import { Subscription } from 'rxjs';
17
+ import { ɵProfiler as ɵProfiler_2 } from '@angular/core';
17
18
 
18
19
  /**
19
20
  * @description
@@ -4341,7 +4342,7 @@ declare const globalUtilsFunctions: {
4341
4342
  ɵgetInjectorProviders: typeof getInjectorProviders;
4342
4343
  ɵgetInjectorResolutionPath: typeof getInjectorResolutionPath;
4343
4344
  ɵgetInjectorMetadata: typeof getInjectorMetadata;
4344
- ɵsetProfiler: (profiler: ɵProfiler | null) => void;
4345
+ ɵsetProfiler: (profiler: ɵProfiler_2 | null) => void;
4345
4346
  getDirectiveMetadata: typeof getDirectiveMetadata;
4346
4347
  getComponent: typeof getComponent;
4347
4348
  getContext: typeof getContext;
@@ -11752,7 +11753,7 @@ declare type ViewQueriesFunction<T> = <U extends T>(rf: ɵRenderFlags, ctx: U) =
11752
11753
  /**
11753
11754
  * Represents an Angular view.
11754
11755
  *
11755
- * @see {@link ChangeDetectorRef#usage-notes Change detection usage}
11756
+ * @see [Change detection usage](/api/core/ChangeDetectorRef?tab=usage-notes)
11756
11757
  *
11757
11758
  * @publicApi
11758
11759
  */
@@ -11868,7 +11869,10 @@ export declare const enum ɵAnimationRendererType {
11868
11869
  * @param doc A reference to the current Document instance.
11869
11870
  * @return event types that need to be replayed
11870
11871
  */
11871
- export declare function ɵannotateForHydration(appRef: ApplicationRef, doc: Document): Set<string> | undefined;
11872
+ export declare function ɵannotateForHydration(appRef: ApplicationRef, doc: Document): {
11873
+ regular: Set<string>;
11874
+ capture: Set<string>;
11875
+ };
11872
11876
 
11873
11877
 
11874
11878
  /**
@@ -12071,6 +12075,39 @@ export declare abstract class ɵChangeDetectionScheduler {
12071
12075
  abstract runningTick: boolean;
12072
12076
  }
12073
12077
 
12078
+ export declare class ɵChangeDetectionSchedulerImpl implements ɵChangeDetectionScheduler {
12079
+ private readonly appRef;
12080
+ private readonly taskService;
12081
+ private readonly ngZone;
12082
+ private readonly zonelessEnabled;
12083
+ private readonly disableScheduling;
12084
+ private readonly zoneIsDefined;
12085
+ private readonly schedulerTickApplyArgs;
12086
+ private readonly subscriptions;
12087
+ private cancelScheduledCallback;
12088
+ private shouldRefreshViews;
12089
+ private useMicrotaskScheduler;
12090
+ runningTick: boolean;
12091
+ pendingRenderTaskId: number | null;
12092
+ constructor();
12093
+ notify(source: ɵNotificationSource): void;
12094
+ private shouldScheduleTick;
12095
+ /**
12096
+ * Calls ApplicationRef._tick inside the `NgZone`.
12097
+ *
12098
+ * Calling `tick` directly runs change detection and cancels any change detection that had been
12099
+ * scheduled previously.
12100
+ *
12101
+ * @param shouldRefreshViews Passed directly to `ApplicationRef._tick` and skips straight to
12102
+ * render hooks when `false`.
12103
+ */
12104
+ private tick;
12105
+ ngOnDestroy(): void;
12106
+ private cleanup;
12107
+ static ɵfac: i0.ɵɵFactoryDeclaration<ɵChangeDetectionSchedulerImpl, never>;
12108
+ static ɵprov: i0.ɵɵInjectableDeclaration<ɵChangeDetectionSchedulerImpl>;
12109
+ }
12110
+
12074
12111
  export declare function ɵclearResolutionOfComponentResourcesQueue(): Map<Type<any>, Component>;
12075
12112
 
12076
12113
  /**
@@ -13208,7 +13245,6 @@ export declare interface ɵProfiler {
13208
13245
  (event: ɵProfilerEvent, instance: {} | null, hookOrListener?: (e?: any) => any): void;
13209
13246
  }
13210
13247
 
13211
-
13212
13248
  /**
13213
13249
  * Profiler events is an enum used by the profiler to distinguish between different calls of user
13214
13250
  * code invoked throughout the application lifecycle.
@@ -13489,7 +13525,7 @@ export declare class ɵRuntimeError<T extends number = ɵRuntimeErrorCode> exten
13489
13525
  * angular.io. This extra annotation is needed to avoid introducing a separate set to store
13490
13526
  * error codes which have guides, which might leak into runtime code.
13491
13527
  *
13492
- * Full list of available error guides can be found at https://angular.io/errors.
13528
+ * Full list of available error guides can be found at https://angular.dev/errors.
13493
13529
  *
13494
13530
  * Error code ranges per package:
13495
13531
  * - core (this package): 100-999
@@ -13822,7 +13858,7 @@ export declare class ɵViewRef<T> implements EmbeddedViewRef<T>, ChangeDetectorR
13822
13858
  *
13823
13859
  * This may be different from `_lView` if the `_cdRefInjectingView` is an embedded view.
13824
13860
  */
13825
- _cdRefInjectingView?: LView<unknown> | undefined, notifyErrorHandler?: boolean);
13861
+ _cdRefInjectingView?: LView | undefined, notifyErrorHandler?: boolean);
13826
13862
  get context(): T;
13827
13863
  /**
13828
13864
  * @deprecated Replacing the full context object is not supported. Modify the context
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular/core",
3
- "version": "18.0.0",
3
+ "version": "18.1.0-next.0",
4
4
  "description": "Angular - the core framework",
5
5
  "author": "angular",
6
6
  "license": "MIT",
@@ -1,11 +1,11 @@
1
1
  /**
2
- * @license Angular v18.0.0
2
+ * @license Angular v18.1.0-next.0
3
3
  * (c) 2010-2024 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
6
6
 
7
7
 
8
- declare namespace a11yClick {
8
+ declare namespace a11yClickLib {
9
9
  export {
10
10
  updateEventInfoForA11yClick,
11
11
  preventDefaultForA11yClick,
@@ -24,54 +24,6 @@ declare interface ActionInfo {
24
24
 
25
25
  declare type ActionInfoInternal = [name: string, element: Element];
26
26
 
27
- /** Resolves actions for Events. */
28
- declare class ActionResolver {
29
- private a11yClickSupport;
30
- private readonly syntheticMouseEventSupport;
31
- private updateEventInfoForA11yClick?;
32
- private preventDefaultForA11yClick?;
33
- private populateClickOnlyAction?;
34
- constructor({ syntheticMouseEventSupport, }?: {
35
- syntheticMouseEventSupport?: boolean;
36
- });
37
- resolve(eventInfo: eventInfoLib.EventInfo): void;
38
- /**
39
- * Searches for a jsaction that the DOM event maps to and creates an
40
- * object containing event information used for dispatching by
41
- * jsaction.Dispatcher. This method populates the `action` and `actionElement`
42
- * fields of the EventInfo object passed in by finding the first
43
- * jsaction attribute above the target Node of the event, and below
44
- * the container Node, that specifies a jsaction for the event
45
- * type. If no such jsaction is found, then action is undefined.
46
- *
47
- * @param eventInfo `EventInfo` to set `action` and `actionElement` if an
48
- * action is found on any `Element` in the path of the `Event`.
49
- */
50
- private populateAction;
51
- /**
52
- * Accesses the jsaction map on a node and retrieves the name of the
53
- * action the given event is mapped to, if any. It parses the
54
- * attribute value and stores it in a property on the node for
55
- * subsequent retrieval without re-parsing and re-accessing the
56
- * attribute.
57
- *
58
- * @param actionElement The DOM node to retrieve the jsaction map from.
59
- * @param eventInfo `EventInfo` to set `action` and `actionElement` if an
60
- * action is found on the `actionElement`.
61
- */
62
- private populateActionOnElement;
63
- /**
64
- * Parses and caches an element's jsaction element into a map.
65
- *
66
- * This is primarily for internal use.
67
- *
68
- * @param actionElement The DOM node to retrieve the jsaction map from.
69
- * @return Map from event to qualified name of the jsaction bound to it.
70
- */
71
- private parseActions;
72
- addA11yClickSupport(updateEventInfoForA11yClick: typeof a11yClick.updateEventInfoForA11yClick, preventDefaultForA11yClick: typeof a11yClick.preventDefaultForA11yClick, populateClickOnlyAction: typeof a11yClick.populateClickOnlyAction): void;
73
- }
74
-
75
27
  /**
76
28
  * Provides a factory function for bootstrapping an event contract on a
77
29
  * specified object (by default, exposed on the `window`).
@@ -113,62 +65,8 @@ declare function createEventInfo({ eventType, event, targetElement, container, t
113
65
  */
114
66
  declare function createEventInfoFromParameters(eventType: string, event: Event, targetElement: Element, container: Element, timestamp: number, action?: ActionInfoInternal, isReplay?: boolean, a11yClickKey?: boolean): EventInfo;
115
67
 
116
- /**
117
- * Receives a DOM event, determines the jsaction associated with the source
118
- * element of the DOM event, and invokes the handler associated with the
119
- * jsaction.
120
- */
121
- export declare class Dispatcher {
122
- private readonly dispatchDelegate;
123
- private actionResolver?;
124
- /** The replayer function to be called when there are queued events. */
125
- private eventReplayer;
126
- /** Whether the event replay is scheduled. */
127
- private eventReplayScheduled;
128
- /** The queue of events. */
129
- private readonly replayEventInfoWrappers;
130
- /**
131
- * Options are:
132
- * - `eventReplayer`: When the event contract dispatches replay events
133
- * to the Dispatcher, the Dispatcher collects them and in the next tick
134
- * dispatches them to the `eventReplayer`. Defaults to dispatching to `dispatchDelegate`.
135
- * @param dispatchDelegate A function that should handle dispatching an `EventInfoWrapper` to handlers.
136
- */
137
- constructor(dispatchDelegate: (eventInfoWrapper: EventInfoWrapper) => void, { actionResolver, eventReplayer, }?: {
138
- actionResolver?: ActionResolver;
139
- eventReplayer?: Replayer;
140
- });
141
- /**
142
- * Receives an event or the event queue from the EventContract. The event
143
- * queue is copied and it attempts to replay.
144
- * If event info is passed in it looks for an action handler that can handle
145
- * the given event. If there is no handler registered queues the event and
146
- * checks if a loader is registered for the given namespace. If so, calls it.
147
- *
148
- * Alternatively, if in global dispatch mode, calls all registered global
149
- * handlers for the appropriate event type.
150
- *
151
- * The three functionalities of this call are deliberately not split into
152
- * three methods (and then declared as an abstract interface), because the
153
- * interface is used by EventContract, which lives in a different jsbinary.
154
- * Therefore the interface between the three is defined entirely in terms that
155
- * are invariant under jscompiler processing (Function and Array, as opposed
156
- * to a custom type with method names).
157
- *
158
- * @param eventInfo The info for the event that triggered this call or the
159
- * queue of events from EventContract.
160
- */
161
- dispatch(eventInfo: EventInfo): void;
162
- /**
163
- * Schedules an `EventInfoWrapper` for replay. The replaying will happen in its own
164
- * stack once the current flow cedes control. This is done to mimic
165
- * browser event handling.
166
- */
167
- private scheduleEventInfoWrapperReplay;
168
- }
169
-
170
68
  /** A function that is called to handle events captured by the EventContract. */
171
- declare type Dispatcher_2 = (eventInfo: eventInfoLib.EventInfo, globalDispatch?: boolean) => void;
69
+ declare type Dispatcher = (eventInfo: eventInfoLib.EventInfo, globalDispatch?: boolean) => void;
172
70
 
173
71
  /**
174
72
  * Defines the early jsaction data types.
@@ -234,7 +132,7 @@ export declare class EventContract implements UnrenamedEventContract {
234
132
  private queuedEventInfos;
235
133
  /** Whether to add an a11y click listener. */
236
134
  private addA11yClickListener;
237
- ecaacs?: (updateEventInfoForA11yClick: typeof a11yClick.updateEventInfoForA11yClick, preventDefaultForA11yClick: typeof a11yClick.preventDefaultForA11yClick, populateClickOnlyAction: typeof a11yClick.populateClickOnlyAction) => void;
135
+ ecaacs?: (updateEventInfoForA11yClick: typeof a11yClickLib.updateEventInfoForA11yClick, preventDefaultForA11yClick: typeof a11yClickLib.preventDefaultForA11yClick, populateClickOnlyAction: typeof a11yClickLib.populateClickOnlyAction) => void;
238
136
  constructor(containerManager: EventContractContainerManager, useActionResolver?: boolean);
239
137
  private handleEvent;
240
138
  /**
@@ -285,13 +183,13 @@ export declare class EventContract implements UnrenamedEventContract {
285
183
  * @param dispatcher The dispatcher function.
286
184
  * @param restriction
287
185
  */
288
- registerDispatcher(dispatcher: Dispatcher_2, restriction: Restriction): void;
186
+ registerDispatcher(dispatcher: Dispatcher, restriction: Restriction): void;
289
187
  /**
290
188
  * Unrenamed alias for registerDispatcher. Necessary for any codebases that
291
189
  * split the `EventContract` and `Dispatcher` code into different compilation
292
190
  * units.
293
191
  */
294
- ecrd(dispatcher: Dispatcher_2, restriction: Restriction): void;
192
+ ecrd(dispatcher: Dispatcher, restriction: Restriction): void;
295
193
  /**
296
194
  * Adds a11y click support to the given `EventContract`. Meant to be called in
297
195
  * the same compilation unit as the `EventContract`.
@@ -353,6 +251,23 @@ export declare type EventContractTracker<T> = {
353
251
  };
354
252
  };
355
253
 
254
+ /**
255
+ * A dispatcher that uses browser-based `Event` semantics, for example bubbling, `stopPropagation`,
256
+ * `currentTarget`, etc.
257
+ */
258
+ export declare class EventDispatcher {
259
+ private readonly dispatchDelegate;
260
+ private readonly actionResolver;
261
+ private readonly dispatcher;
262
+ constructor(dispatchDelegate: (event: Event, actionName: string) => void);
263
+ /**
264
+ * The entrypoint for the `EventContract` dispatch.
265
+ */
266
+ dispatch(eventInfo: EventInfo): void;
267
+ /** Internal method that does basic disaptching. */
268
+ private dispatchToDelegate;
269
+ }
270
+
356
271
  /**
357
272
  * A function that handles an event dispatched from the browser.
358
273
  *
@@ -469,6 +384,11 @@ export declare class EventInfoWrapper {
469
384
  clone(): EventInfoWrapper;
470
385
  }
471
386
 
387
+ /** Extra event phases beyond what the browser provides. */
388
+ export declare const EventPhase: {
389
+ REPLAY: number;
390
+ };
391
+
472
392
  /** Added for readability when accessing stable property names. */
473
393
  declare function getA11yClickKey(eventInfo: EventInfo): boolean | undefined;
474
394
 
@@ -502,6 +422,20 @@ declare function getTargetElement(eventInfo: EventInfo): Element;
502
422
  /** Added for readability when accessing stable property names. */
503
423
  declare function getTimestamp(eventInfo: EventInfo): number;
504
424
 
425
+ /**
426
+ *
427
+ * Decides whether or not an event type is an event that only has a capture phase.
428
+ *
429
+ * @param eventType
430
+ * @returns bool
431
+ */
432
+ export declare const isCaptureEvent: (eventType: string) => boolean;
433
+
434
+ /**
435
+ * Detects whether a given event type is supported by JSAction.
436
+ */
437
+ export declare const isSupportedEvent: (eventType: string) => boolean;
438
+
505
439
  /**
506
440
  * Sets the `action` to `clickonly` for a click event that is not an a11y click
507
441
  * and if there is not already a click action.
@@ -520,13 +454,7 @@ declare function preventDefaultForA11yClick(eventInfo: eventInfoLib.EventInfo):
520
454
  * Registers deferred functionality for an EventContract and a Jsaction
521
455
  * Dispatcher.
522
456
  */
523
- export declare function registerDispatcher(eventContract: UnrenamedEventContract, dispatcher: Dispatcher): void;
524
-
525
- /**
526
- * A replayer is a function that is called when there are queued events,
527
- * either from the `EventContract` or when there are no detected handlers.
528
- */
529
- declare type Replayer = (eventInfoWrappers: EventInfoWrapper[]) => void;
457
+ export declare function registerDispatcher(eventContract: UnrenamedEventContract, dispatcher: EventDispatcher): void;
530
458
 
531
459
 
532
460
  /**
@@ -567,8 +495,8 @@ declare function setTimestamp(eventInfo: EventInfo, timestamp: number): void;
567
495
  * The API of an EventContract that is safe to call from any compilation unit.
568
496
  */
569
497
  declare interface UnrenamedEventContract {
570
- ecrd(dispatcher: Dispatcher_2, restriction: Restriction): void;
571
- ecaacs?: (updateEventInfoForA11yClick: typeof a11yClick.updateEventInfoForA11yClick, preventDefaultForA11yClick: typeof a11yClick.preventDefaultForA11yClick, populateClickOnlyAction: typeof a11yClick.populateClickOnlyAction) => void;
498
+ ecrd(dispatcher: Dispatcher, restriction: Restriction): void;
499
+ ecaacs?: (updateEventInfoForA11yClick: typeof a11yClickLib.updateEventInfoForA11yClick, preventDefaultForA11yClick: typeof a11yClickLib.preventDefaultForA11yClick, populateClickOnlyAction: typeof a11yClickLib.populateClickOnlyAction) => void;
572
500
  }
573
501
 
574
502
  /** Added for readability when accessing stable property names. */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v18.0.0
2
+ * @license Angular v18.1.0-next.0
3
3
  * (c) 2010-2024 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v18.0.0
2
+ * @license Angular v18.1.0-next.0
3
3
  * (c) 2010-2024 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -471,7 +471,7 @@ function getImportOfIdentifier(typeChecker, node) {
471
471
  return null;
472
472
  }
473
473
  const importDecl = decl.parent.parent.parent;
474
- if (!import_typescript5.default.isStringLiteral(importDecl.moduleSpecifier)) {
474
+ if (!import_typescript5.default.isImportDeclaration(importDecl) || !import_typescript5.default.isStringLiteral(importDecl.moduleSpecifier)) {
475
475
  return null;
476
476
  }
477
477
  return {