@angular/core 18.0.0-rc.3 → 18.0.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 (43) 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/error_details_base_url.mjs +2 -2
  13. package/esm2022/src/errors.mjs +1 -1
  14. package/esm2022/src/hydration/annotate.mjs +11 -6
  15. package/esm2022/src/hydration/event_replay.mjs +23 -26
  16. package/esm2022/src/image_performance_warning.mjs +3 -3
  17. package/esm2022/src/platform/platform_ref.mjs +10 -3
  18. package/esm2022/src/render3/component_ref.mjs +1 -1
  19. package/esm2022/src/render3/instructions/listener.mjs +4 -7
  20. package/esm2022/src/version.mjs +1 -1
  21. package/esm2022/testing/src/logger.mjs +3 -3
  22. package/esm2022/testing/src/test_bed_compiler.mjs +7 -3
  23. package/fesm2022/core.mjs +230 -229
  24. package/fesm2022/core.mjs.map +1 -1
  25. package/fesm2022/primitives/event-dispatch.mjs +1402 -1188
  26. package/fesm2022/primitives/event-dispatch.mjs.map +1 -1
  27. package/fesm2022/primitives/signals.mjs +1 -1
  28. package/fesm2022/rxjs-interop.mjs +1 -1
  29. package/fesm2022/testing.mjs +7 -3
  30. package/fesm2022/testing.mjs.map +1 -1
  31. package/index.d.ts +39 -3
  32. package/package.json +1 -1
  33. package/primitives/event-dispatch/index.d.ts +45 -117
  34. package/primitives/signals/index.d.ts +1 -1
  35. package/rxjs-interop/index.d.ts +1 -1
  36. package/schematics/migrations/invalid-two-way-bindings/bundle.js +4 -2
  37. package/schematics/migrations/invalid-two-way-bindings/bundle.js.map +2 -2
  38. package/schematics/ng-generate/control-flow-migration/bundle.js +5 -3
  39. package/schematics/ng-generate/control-flow-migration/bundle.js.map +2 -2
  40. package/schematics/ng-generate/standalone-migration/bundle.js +15 -13
  41. package/schematics/ng-generate/standalone-migration/bundle.js.map +2 -2
  42. package/testing/index.d.ts +1 -1
  43. 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-rc.3
2
+ * @license Angular v18.0.1
3
3
  * (c) 2010-2024 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -11868,7 +11868,10 @@ export declare const enum ɵAnimationRendererType {
11868
11868
  * @param doc A reference to the current Document instance.
11869
11869
  * @return event types that need to be replayed
11870
11870
  */
11871
- export declare function ɵannotateForHydration(appRef: ApplicationRef, doc: Document): Set<string> | undefined;
11871
+ export declare function ɵannotateForHydration(appRef: ApplicationRef, doc: Document): {
11872
+ regular: Set<string>;
11873
+ capture: Set<string>;
11874
+ };
11872
11875
 
11873
11876
 
11874
11877
  /**
@@ -12071,6 +12074,39 @@ export declare abstract class ɵChangeDetectionScheduler {
12071
12074
  abstract runningTick: boolean;
12072
12075
  }
12073
12076
 
12077
+ export declare class ɵChangeDetectionSchedulerImpl implements ɵChangeDetectionScheduler {
12078
+ private readonly appRef;
12079
+ private readonly taskService;
12080
+ private readonly ngZone;
12081
+ private readonly zonelessEnabled;
12082
+ private readonly disableScheduling;
12083
+ private readonly zoneIsDefined;
12084
+ private readonly schedulerTickApplyArgs;
12085
+ private readonly subscriptions;
12086
+ private cancelScheduledCallback;
12087
+ private shouldRefreshViews;
12088
+ private useMicrotaskScheduler;
12089
+ runningTick: boolean;
12090
+ pendingRenderTaskId: number | null;
12091
+ constructor();
12092
+ notify(source: ɵNotificationSource): void;
12093
+ private shouldScheduleTick;
12094
+ /**
12095
+ * Calls ApplicationRef._tick inside the `NgZone`.
12096
+ *
12097
+ * Calling `tick` directly runs change detection and cancels any change detection that had been
12098
+ * scheduled previously.
12099
+ *
12100
+ * @param shouldRefreshViews Passed directly to `ApplicationRef._tick` and skips straight to
12101
+ * render hooks when `false`.
12102
+ */
12103
+ private tick;
12104
+ ngOnDestroy(): void;
12105
+ private cleanup;
12106
+ static ɵfac: i0.ɵɵFactoryDeclaration<ɵChangeDetectionSchedulerImpl, never>;
12107
+ static ɵprov: i0.ɵɵInjectableDeclaration<ɵChangeDetectionSchedulerImpl>;
12108
+ }
12109
+
12074
12110
  export declare function ɵclearResolutionOfComponentResourcesQueue(): Map<Type<any>, Component>;
12075
12111
 
12076
12112
  /**
@@ -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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular/core",
3
- "version": "18.0.0-rc.3",
3
+ "version": "18.0.1",
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-rc.3
2
+ * @license Angular v18.0.1
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-rc.3
2
+ * @license Angular v18.0.1
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-rc.3
2
+ * @license Angular v18.0.1
3
3
  * (c) 2010-2024 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -18256,7 +18256,7 @@ function optimizeTrackFns(job) {
18256
18256
  }
18257
18257
  }
18258
18258
  function isTrackByFunctionCall(rootView, expr) {
18259
- if (!(expr instanceof InvokeFunctionExpr) || expr.args.length !== 2) {
18259
+ if (!(expr instanceof InvokeFunctionExpr) || expr.args.length === 0 || expr.args.length > 2) {
18260
18260
  return false;
18261
18261
  }
18262
18262
  if (!(expr.receiver instanceof ReadPropExpr && expr.receiver.receiver instanceof ContextExpr) || expr.receiver.receiver.view !== rootView) {
@@ -18265,6 +18265,8 @@ function isTrackByFunctionCall(rootView, expr) {
18265
18265
  const [arg0, arg1] = expr.args;
18266
18266
  if (!(arg0 instanceof ReadVarExpr) || arg0.name !== "$index") {
18267
18267
  return false;
18268
+ } else if (expr.args.length === 1) {
18269
+ return true;
18268
18270
  }
18269
18271
  if (!(arg1 instanceof ReadVarExpr) || arg1.name !== "$item") {
18270
18272
  return false;
@@ -23044,7 +23046,7 @@ function publishFacade(global) {
23044
23046
  }
23045
23047
 
23046
23048
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/version.mjs
23047
- var VERSION2 = new Version("18.0.0-rc.3");
23049
+ var VERSION2 = new Version("18.0.1");
23048
23050
 
23049
23051
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/i18n/extractor_merger.mjs
23050
23052
  var _VisitorMode;