@angular/core 18.0.0-rc.2 → 18.0.0-rc.3
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/esm2022/primitives/event-dispatch/src/action_resolver.mjs +5 -1
- package/esm2022/primitives/event-dispatch/src/attribute.mjs +4 -15
- package/esm2022/primitives/event-dispatch/src/cache.mjs +2 -35
- package/esm2022/primitives/event-dispatch/src/dispatcher.mjs +15 -28
- package/esm2022/primitives/event-dispatch/src/event_info.mjs +16 -1
- package/esm2022/primitives/event-dispatch/src/property.mjs +1 -7
- package/esm2022/src/change_detection/scheduling/exhaustive_check_no_changes.mjs +5 -5
- package/esm2022/src/change_detection/scheduling/zoneless_scheduling_impl.mjs +8 -2
- package/esm2022/src/errors.mjs +1 -1
- package/esm2022/src/hydration/event_replay.mjs +11 -6
- package/esm2022/src/render3/component_ref.mjs +1 -1
- package/esm2022/src/render3/instructions/change_detection.mjs +17 -6
- package/esm2022/src/version.mjs +1 -1
- package/esm2022/testing/src/logger.mjs +3 -3
- package/event-dispatch-contract.min.js +1 -1
- package/fesm2022/core.mjs +38 -16
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/primitives/event-dispatch.mjs +38 -82
- package/fesm2022/primitives/event-dispatch.mjs.map +1 -1
- package/fesm2022/primitives/signals.mjs +1 -1
- package/fesm2022/rxjs-interop.mjs +1 -1
- package/fesm2022/testing.mjs +1 -1
- package/index.d.ts +4 -3
- package/package.json +1 -1
- package/primitives/event-dispatch/index.d.ts +16 -4
- package/primitives/signals/index.d.ts +1 -1
- package/rxjs-interop/index.d.ts +1 -1
- package/schematics/migrations/invalid-two-way-bindings/bundle.js +5 -1
- package/schematics/migrations/invalid-two-way-bindings/bundle.js.map +3 -3
- package/schematics/ng-generate/control-flow-migration/bundle.js +5 -1
- package/schematics/ng-generate/control-flow-migration/bundle.js.map +3 -3
- package/schematics/ng-generate/standalone-migration/bundle.js +38 -19
- package/schematics/ng-generate/standalone-migration/bundle.js.map +3 -3
- package/testing/index.d.ts +1 -1
- package/esm2022/primitives/event-dispatch/src/legacy_dispatcher.mjs +0 -259
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v18.0.0-rc.
|
|
2
|
+
* @license Angular v18.0.0-rc.3
|
|
3
3
|
* (c) 2010-2024 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -80,6 +80,14 @@ function getA11yClickKey(eventInfo) {
|
|
|
80
80
|
function setA11yClickKey(eventInfo, a11yClickKey) {
|
|
81
81
|
eventInfo.eiack = a11yClickKey;
|
|
82
82
|
}
|
|
83
|
+
/** Added for readability when accessing stable property names. */
|
|
84
|
+
function getResolved(eventInfo) {
|
|
85
|
+
return eventInfo.eir;
|
|
86
|
+
}
|
|
87
|
+
/** Added for readability when accessing stable property names. */
|
|
88
|
+
function setResolved(eventInfo, resolved) {
|
|
89
|
+
eventInfo.eir = resolved;
|
|
90
|
+
}
|
|
83
91
|
/** Clones an `EventInfo` */
|
|
84
92
|
function cloneEventInfo(eventInfo) {
|
|
85
93
|
return {
|
|
@@ -91,6 +99,7 @@ function cloneEventInfo(eventInfo) {
|
|
|
91
99
|
timeStamp: eventInfo.timeStamp,
|
|
92
100
|
eirp: eventInfo.eirp,
|
|
93
101
|
eiack: eventInfo.eiack,
|
|
102
|
+
eir: eventInfo.eir,
|
|
94
103
|
};
|
|
95
104
|
}
|
|
96
105
|
/**
|
|
@@ -191,6 +200,12 @@ class EventInfoWrapper {
|
|
|
191
200
|
setIsReplay(replay) {
|
|
192
201
|
setIsReplay(this.eventInfo, replay);
|
|
193
202
|
}
|
|
203
|
+
getResolved() {
|
|
204
|
+
return getResolved(this.eventInfo);
|
|
205
|
+
}
|
|
206
|
+
setResolved(resolved) {
|
|
207
|
+
setResolved(this.eventInfo, resolved);
|
|
208
|
+
}
|
|
194
209
|
clone() {
|
|
195
210
|
return new EventInfoWrapper(cloneEventInfo(this.eventInfo));
|
|
196
211
|
}
|
|
@@ -576,7 +591,7 @@ function removeEventListener(element, info) {
|
|
|
576
591
|
* Cancels propagation of an event.
|
|
577
592
|
* @param e The event to cancel propagation for.
|
|
578
593
|
*/
|
|
579
|
-
function stopPropagation
|
|
594
|
+
function stopPropagation(e) {
|
|
580
595
|
e.stopPropagation ? e.stopPropagation() : (e.cancelBubble = true);
|
|
581
596
|
}
|
|
582
597
|
/**
|
|
@@ -1130,12 +1145,12 @@ const testing = {
|
|
|
1130
1145
|
class Dispatcher {
|
|
1131
1146
|
/**
|
|
1132
1147
|
* Options are:
|
|
1133
|
-
*
|
|
1148
|
+
* - `eventReplayer`: When the event contract dispatches replay events
|
|
1134
1149
|
* to the Dispatcher, the Dispatcher collects them and in the next tick
|
|
1135
|
-
* dispatches them to the `eventReplayer`.
|
|
1150
|
+
* dispatches them to the `eventReplayer`. Defaults to dispatching to `dispatchDelegate`.
|
|
1136
1151
|
* @param dispatchDelegate A function that should handle dispatching an `EventInfoWrapper` to handlers.
|
|
1137
1152
|
*/
|
|
1138
|
-
constructor(dispatchDelegate, { actionResolver
|
|
1153
|
+
constructor(dispatchDelegate, { actionResolver, eventReplayer = createEventReplayer(dispatchDelegate), } = {}) {
|
|
1139
1154
|
this.dispatchDelegate = dispatchDelegate;
|
|
1140
1155
|
/** Whether the event replay is scheduled. */
|
|
1141
1156
|
this.eventReplayScheduled = false;
|
|
@@ -1172,9 +1187,6 @@ class Dispatcher {
|
|
|
1172
1187
|
preventDefault(eventInfoWrapper.getEvent());
|
|
1173
1188
|
}
|
|
1174
1189
|
if (eventInfoWrapper.getIsReplay()) {
|
|
1175
|
-
if (!this.eventReplayer) {
|
|
1176
|
-
return;
|
|
1177
|
-
}
|
|
1178
1190
|
this.scheduleEventInfoWrapperReplay(eventInfoWrapper);
|
|
1179
1191
|
return;
|
|
1180
1192
|
}
|
|
@@ -1187,7 +1199,7 @@ class Dispatcher {
|
|
|
1187
1199
|
*/
|
|
1188
1200
|
scheduleEventInfoWrapperReplay(eventInfoWrapper) {
|
|
1189
1201
|
this.replayEventInfoWrappers.push(eventInfoWrapper);
|
|
1190
|
-
if (this.eventReplayScheduled
|
|
1202
|
+
if (this.eventReplayScheduled) {
|
|
1191
1203
|
return;
|
|
1192
1204
|
}
|
|
1193
1205
|
this.eventReplayScheduled = true;
|
|
@@ -1197,26 +1209,16 @@ class Dispatcher {
|
|
|
1197
1209
|
});
|
|
1198
1210
|
}
|
|
1199
1211
|
}
|
|
1200
|
-
/**
|
|
1201
|
-
function
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
*/
|
|
1211
|
-
return;
|
|
1212
|
-
}
|
|
1213
|
-
const event = eventInfoWrapper.getEvent();
|
|
1214
|
-
// There are some cases where users of the `Dispatcher` will call dispatch
|
|
1215
|
-
// with a fake event that does not support `stopPropagation`.
|
|
1216
|
-
if (!event.stopPropagation) {
|
|
1217
|
-
return;
|
|
1218
|
-
}
|
|
1219
|
-
event.stopPropagation();
|
|
1212
|
+
/**
|
|
1213
|
+
* Creates an `EventReplayer` that calls the `replay` function for every `eventInfoWrapper` in
|
|
1214
|
+
* the queue.
|
|
1215
|
+
*/
|
|
1216
|
+
function createEventReplayer(replay) {
|
|
1217
|
+
return (eventInfoWrappers) => {
|
|
1218
|
+
for (const eventInfoWrapper of eventInfoWrappers) {
|
|
1219
|
+
replay(eventInfoWrapper);
|
|
1220
|
+
}
|
|
1221
|
+
};
|
|
1220
1222
|
}
|
|
1221
1223
|
/**
|
|
1222
1224
|
* Returns true if the default action of this event should be prevented before
|
|
@@ -1347,22 +1349,11 @@ function populateClickOnlyAction(actionElement, eventInfo, actionMap) {
|
|
|
1347
1349
|
* an optional DOM event name and a jsaction name. If the optional
|
|
1348
1350
|
* DOM event name is omitted, 'click' is assumed. The jsaction names
|
|
1349
1351
|
* are dot separated pairs of a namespace and a simple jsaction
|
|
1350
|
-
* name.
|
|
1351
|
-
* ancestor element with a jsnamespace attribute, if there is
|
|
1352
|
-
* any. If there is no ancestor with a jsnamespace attribute, the
|
|
1353
|
-
* simple name is assumed to be the jsaction name.
|
|
1352
|
+
* name.
|
|
1354
1353
|
*
|
|
1355
|
-
*
|
|
1354
|
+
* See grammar in README.md for expected syntax in the attribute value.
|
|
1356
1355
|
*/
|
|
1357
1356
|
const JSACTION$1 = 'jsaction';
|
|
1358
|
-
/**
|
|
1359
|
-
* The jsnamespace attribute provides the namespace part of the
|
|
1360
|
-
* jaction names occurring in the jsaction attribute where it's
|
|
1361
|
-
* missing.
|
|
1362
|
-
*
|
|
1363
|
-
* Used by EventContract.
|
|
1364
|
-
*/
|
|
1365
|
-
const JSNAMESPACE$1 = 'jsnamespace';
|
|
1366
1357
|
/**
|
|
1367
1358
|
* The oi attribute is a log impression tag for impression logging
|
|
1368
1359
|
* and action tracking. For an element that carries a jsaction
|
|
@@ -1400,7 +1391,7 @@ const JSINSTANCE = 'jsinstance';
|
|
|
1400
1391
|
* Used by ActionFlow.
|
|
1401
1392
|
*/
|
|
1402
1393
|
const JSTRACK = 'jstrack';
|
|
1403
|
-
const Attribute = { JSACTION: JSACTION$1,
|
|
1394
|
+
const Attribute = { JSACTION: JSACTION$1, OI: OI$1, VED, VET, JSINSTANCE, JSTRACK };
|
|
1404
1395
|
|
|
1405
1396
|
const Char = {
|
|
1406
1397
|
/**
|
|
@@ -1439,11 +1430,6 @@ const Char = {
|
|
|
1439
1430
|
* property lookup is faster than attribute access.
|
|
1440
1431
|
*/
|
|
1441
1432
|
const JSACTION = '__jsaction';
|
|
1442
|
-
/**
|
|
1443
|
-
* The parsed value of the jsnamespace attribute is stored in this
|
|
1444
|
-
* property on the DOM node.
|
|
1445
|
-
*/
|
|
1446
|
-
const JSNAMESPACE = '__jsnamespace';
|
|
1447
1433
|
/** The value of the oi attribute as a property, for faster access. */
|
|
1448
1434
|
const OI = '__oi';
|
|
1449
1435
|
/**
|
|
@@ -1456,7 +1442,6 @@ const OWNER = '__owner';
|
|
|
1456
1442
|
/** All properties that are used by jsaction. */
|
|
1457
1443
|
const Property = {
|
|
1458
1444
|
JSACTION,
|
|
1459
|
-
JSNAMESPACE,
|
|
1460
1445
|
OI,
|
|
1461
1446
|
OWNER,
|
|
1462
1447
|
};
|
|
@@ -1514,39 +1499,6 @@ function clear(element) {
|
|
|
1514
1499
|
delete element[JSACTION];
|
|
1515
1500
|
}
|
|
1516
1501
|
}
|
|
1517
|
-
/**
|
|
1518
|
-
* Reads the cached jsaction namespace from the given DOM
|
|
1519
|
-
* Element. Undefined means there is no cached value; null is a cached
|
|
1520
|
-
* jsnamespace attribute that's absent.
|
|
1521
|
-
*
|
|
1522
|
-
* @param element .
|
|
1523
|
-
* @return .
|
|
1524
|
-
*/
|
|
1525
|
-
function getNamespace(element) {
|
|
1526
|
-
// @ts-ignore
|
|
1527
|
-
return element[JSNAMESPACE];
|
|
1528
|
-
}
|
|
1529
|
-
/**
|
|
1530
|
-
* Writes the cached jsaction namespace to the given DOM Element. Null
|
|
1531
|
-
* represents a jsnamespace attribute that's absent.
|
|
1532
|
-
*
|
|
1533
|
-
* @param element .
|
|
1534
|
-
* @param jsnamespace .
|
|
1535
|
-
*/
|
|
1536
|
-
function setNamespace(element, jsnamespace) {
|
|
1537
|
-
// @ts-ignore
|
|
1538
|
-
element[JSNAMESPACE] = jsnamespace;
|
|
1539
|
-
}
|
|
1540
|
-
/**
|
|
1541
|
-
* Clears the cached jsaction namespace from the given DOM Element.
|
|
1542
|
-
*
|
|
1543
|
-
* @param element .
|
|
1544
|
-
*/
|
|
1545
|
-
function clearNamespace(element) {
|
|
1546
|
-
if (JSNAMESPACE in element) {
|
|
1547
|
-
delete element[JSNAMESPACE];
|
|
1548
|
-
}
|
|
1549
|
-
}
|
|
1550
1502
|
|
|
1551
1503
|
/**
|
|
1552
1504
|
* Since maps from event to action are immutable we can use a single map
|
|
@@ -1569,7 +1521,11 @@ class ActionResolver {
|
|
|
1569
1521
|
this.syntheticMouseEventSupport = syntheticMouseEventSupport;
|
|
1570
1522
|
}
|
|
1571
1523
|
resolve(eventInfo) {
|
|
1524
|
+
if (getResolved(eventInfo)) {
|
|
1525
|
+
return;
|
|
1526
|
+
}
|
|
1572
1527
|
this.populateAction(eventInfo);
|
|
1528
|
+
setResolved(eventInfo, true);
|
|
1573
1529
|
}
|
|
1574
1530
|
/**
|
|
1575
1531
|
* Searches for a jsaction that the DOM event maps to and creates an
|