@angular/core 21.0.0-next.0 → 21.0.0-next.10
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/fesm2022/_attribute-chunk.mjs +12 -0
- package/fesm2022/_attribute-chunk.mjs.map +1 -0
- package/fesm2022/_debug_node-chunk.mjs +18469 -0
- package/fesm2022/_debug_node-chunk.mjs.map +1 -0
- package/fesm2022/_effect-chunk.mjs +423 -0
- package/fesm2022/_effect-chunk.mjs.map +1 -0
- package/fesm2022/_effect-chunk2.mjs +2951 -0
- package/fesm2022/_effect-chunk2.mjs.map +1 -0
- package/fesm2022/_not_found-chunk.mjs +39 -0
- package/fesm2022/_not_found-chunk.mjs.map +1 -0
- package/fesm2022/_resource-chunk.mjs +378 -0
- package/fesm2022/_resource-chunk.mjs.map +1 -0
- package/fesm2022/_untracked-chunk.mjs +96 -0
- package/fesm2022/_untracked-chunk.mjs.map +1 -0
- package/fesm2022/_weak_ref-chunk.mjs +10 -0
- package/fesm2022/_weak_ref-chunk.mjs.map +1 -0
- package/fesm2022/core.mjs +2499 -4185
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/primitives-di.mjs +23 -0
- package/fesm2022/primitives-di.mjs.map +1 -0
- package/fesm2022/primitives-event-dispatch.mjs +788 -0
- package/fesm2022/primitives-event-dispatch.mjs.map +1 -0
- package/fesm2022/primitives-signals.mjs +187 -0
- package/fesm2022/primitives-signals.mjs.map +1 -0
- package/fesm2022/rxjs-interop.mjs +210 -308
- package/fesm2022/rxjs-interop.mjs.map +1 -1
- package/fesm2022/testing.mjs +2309 -3170
- package/fesm2022/testing.mjs.map +1 -1
- package/package.json +18 -12
- package/resources/best-practices.md +56 -0
- package/schematics/bundles/add-bootstrap-context-to-server-main.cjs +117 -0
- package/schematics/bundles/application-config-core.cjs +84 -0
- package/schematics/bundles/{apply_import_manager-DR9xXCle.cjs → apply_import_manager-1Zs_gpB6.cjs} +4 -5
- package/schematics/bundles/bootstrap-options-migration.cjs +598 -0
- package/schematics/bundles/cleanup-unused-imports.cjs +9 -13
- package/schematics/bundles/common-to-standalone-migration.cjs +381 -0
- package/schematics/bundles/{compiler_host-BXBP7CE2.cjs → compiler_host-DBwYMlTo.cjs} +10 -11
- package/schematics/bundles/control-flow-migration.cjs +122 -119
- package/schematics/bundles/{imports-CIX-JgAN.cjs → imports-DP72APSx.cjs} +6 -1
- package/schematics/bundles/{index-CfTQUOiz.cjs → index-B7I9sIUx.cjs} +36 -39
- package/schematics/bundles/inject-migration.cjs +148 -70
- package/schematics/bundles/leading_space-D9nQ8UQC.cjs +1 -1
- package/schematics/bundles/{migrate_ts_type_references-6NtAj-Wk.cjs → migrate_ts_type_references-UGIUl7En.cjs} +500 -24
- package/schematics/bundles/ng_component_template-Dsuq1Lw7.cjs +185 -0
- package/schematics/bundles/{ng_decorators-B5HCqr20.cjs → ng_decorators-DSFlWYQY.cjs} +2 -2
- package/schematics/bundles/ngclass-to-class-migration.cjs +542 -0
- package/schematics/bundles/ngstyle-to-style-migration.cjs +487 -0
- package/schematics/bundles/nodes-B16H9JUd.cjs +1 -1
- package/schematics/bundles/output-migration.cjs +16 -19
- package/schematics/bundles/parse_html-8VLCL37B.cjs +132 -0
- package/schematics/bundles/{project_paths-DcaODbky.cjs → project_paths-DvD50ouC.cjs} +14 -247
- package/schematics/bundles/project_tsconfig_paths-CDVxT6Ov.cjs +90 -0
- package/schematics/bundles/property_name-BBwFuqMe.cjs +1 -1
- package/schematics/bundles/route-lazy-loading.cjs +54 -26
- package/schematics/bundles/router-current-navigation.cjs +7 -18
- package/schematics/bundles/router-last-successful-navigation.cjs +7 -18
- package/schematics/bundles/router-testing-module-migration.cjs +502 -0
- package/schematics/bundles/self-closing-tags-migration.cjs +17 -216
- package/schematics/bundles/signal-input-migration.cjs +93 -29
- package/schematics/bundles/signal-queries-migration.cjs +22 -25
- package/schematics/bundles/signals.cjs +10 -13
- package/schematics/bundles/standalone-migration.cjs +135 -102
- package/schematics/bundles/{symbol-VPWguRxr.cjs → symbol-BObKoqes.cjs} +3 -2
- package/schematics/collection.json +23 -0
- package/schematics/migrations/common-to-standalone-migration/schema.json +14 -0
- package/schematics/migrations/ngclass-to-class-migration/schema.json +20 -0
- package/schematics/migrations/ngstyle-to-style-migration/schema.json +20 -0
- package/schematics/migrations/router-testing-module-migration/schema.json +14 -0
- package/schematics/migrations.json +16 -2
- package/{api.d.d.ts → types/_api-chunk.d.ts} +9 -6
- package/{chrome_dev_tools_performance.d.d.ts → types/_chrome_dev_tools_performance-chunk.d.ts} +26 -31
- package/{discovery.d.d.ts → types/_discovery-chunk.d.ts} +135 -98
- package/{signal.d.d.ts → types/_effect-chunk.d.ts} +14 -5
- package/{event_dispatcher.d.d.ts → types/_event_dispatcher-chunk.d.ts} +2 -2
- package/{graph.d.d.ts → types/_formatter-chunk.d.ts} +40 -7
- package/{weak_ref.d.d.ts → types/_weak_ref-chunk.d.ts} +2 -2
- package/{index.d.ts → types/core.d.ts} +233 -305
- package/{primitives/di/index.d.ts → types/primitives-di.d.ts} +2 -2
- package/{primitives/event-dispatch/index.d.ts → types/primitives-event-dispatch.d.ts} +4 -4
- package/{primitives/signals/index.d.ts → types/primitives-signals.d.ts} +7 -8
- package/{rxjs-interop/index.d.ts → types/rxjs-interop.d.ts} +8 -6
- package/{testing/index.d.ts → types/testing.d.ts} +7 -7
- package/fesm2022/attribute.mjs +0 -24
- package/fesm2022/attribute.mjs.map +0 -1
- package/fesm2022/debug_node.mjs +0 -31833
- package/fesm2022/debug_node.mjs.map +0 -1
- package/fesm2022/not_found.mjs +0 -56
- package/fesm2022/not_found.mjs.map +0 -1
- package/fesm2022/primitives/di.mjs +0 -23
- package/fesm2022/primitives/di.mjs.map +0 -1
- package/fesm2022/primitives/event-dispatch.mjs +0 -1622
- package/fesm2022/primitives/event-dispatch.mjs.map +0 -1
- package/fesm2022/primitives/signals.mjs +0 -89
- package/fesm2022/primitives/signals.mjs.map +0 -1
- package/fesm2022/resource.mjs +0 -633
- package/fesm2022/resource.mjs.map +0 -1
- package/fesm2022/root_effect_scheduler.mjs +0 -4007
- package/fesm2022/root_effect_scheduler.mjs.map +0 -1
- package/fesm2022/signal.mjs +0 -560
- package/fesm2022/signal.mjs.map +0 -1
- package/fesm2022/untracked.mjs +0 -117
- package/fesm2022/untracked.mjs.map +0 -1
- package/fesm2022/weak_ref.mjs +0 -12
- package/fesm2022/weak_ref.mjs.map +0 -1
- package/schematics/bundles/index-esqfDjNB.cjs +0 -22074
- package/schematics/bundles/project_tsconfig_paths-CS-eSeHC.cjs +0 -51062
|
@@ -0,0 +1,788 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Angular v21.0.0-next.10
|
|
3
|
+
* (c) 2010-2025 Google LLC. https://angular.dev/
|
|
4
|
+
* License: MIT
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { Attribute } from './_attribute-chunk.mjs';
|
|
8
|
+
|
|
9
|
+
const Property = {
|
|
10
|
+
JSACTION: '__jsaction',
|
|
11
|
+
OWNER: '__owner'
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const parseCache = {};
|
|
15
|
+
function get(element) {
|
|
16
|
+
return element[Property.JSACTION];
|
|
17
|
+
}
|
|
18
|
+
function getDefaulted(element) {
|
|
19
|
+
const cache = get(element) ?? {};
|
|
20
|
+
set(element, cache);
|
|
21
|
+
return cache;
|
|
22
|
+
}
|
|
23
|
+
function set(element, actionMap) {
|
|
24
|
+
element[Property.JSACTION] = actionMap;
|
|
25
|
+
}
|
|
26
|
+
function getParsed(text) {
|
|
27
|
+
return parseCache[text];
|
|
28
|
+
}
|
|
29
|
+
function setParsed(text, parsed) {
|
|
30
|
+
parseCache[text] = parsed;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const EventType = {
|
|
34
|
+
AUXCLICK: 'auxclick',
|
|
35
|
+
CHANGE: 'change',
|
|
36
|
+
CLICK: 'click',
|
|
37
|
+
CLICKMOD: 'clickmod',
|
|
38
|
+
CLICKONLY: 'clickonly',
|
|
39
|
+
DBLCLICK: 'dblclick',
|
|
40
|
+
FOCUS: 'focus',
|
|
41
|
+
FOCUSIN: 'focusin',
|
|
42
|
+
BLUR: 'blur',
|
|
43
|
+
FOCUSOUT: 'focusout',
|
|
44
|
+
SUBMIT: 'submit',
|
|
45
|
+
KEYDOWN: 'keydown',
|
|
46
|
+
KEYPRESS: 'keypress',
|
|
47
|
+
KEYUP: 'keyup',
|
|
48
|
+
MOUSEUP: 'mouseup',
|
|
49
|
+
MOUSEDOWN: 'mousedown',
|
|
50
|
+
MOUSEOVER: 'mouseover',
|
|
51
|
+
MOUSEOUT: 'mouseout',
|
|
52
|
+
MOUSEENTER: 'mouseenter',
|
|
53
|
+
MOUSELEAVE: 'mouseleave',
|
|
54
|
+
MOUSEMOVE: 'mousemove',
|
|
55
|
+
POINTERUP: 'pointerup',
|
|
56
|
+
POINTERDOWN: 'pointerdown',
|
|
57
|
+
POINTEROVER: 'pointerover',
|
|
58
|
+
POINTEROUT: 'pointerout',
|
|
59
|
+
POINTERENTER: 'pointerenter',
|
|
60
|
+
POINTERLEAVE: 'pointerleave',
|
|
61
|
+
POINTERMOVE: 'pointermove',
|
|
62
|
+
POINTERCANCEL: 'pointercancel',
|
|
63
|
+
GOTPOINTERCAPTURE: 'gotpointercapture',
|
|
64
|
+
LOSTPOINTERCAPTURE: 'lostpointercapture',
|
|
65
|
+
ERROR: 'error',
|
|
66
|
+
LOAD: 'load',
|
|
67
|
+
UNLOAD: 'unload',
|
|
68
|
+
TOUCHSTART: 'touchstart',
|
|
69
|
+
TOUCHEND: 'touchend',
|
|
70
|
+
TOUCHMOVE: 'touchmove',
|
|
71
|
+
INPUT: 'input',
|
|
72
|
+
SCROLL: 'scroll',
|
|
73
|
+
TOGGLE: 'toggle',
|
|
74
|
+
CUSTOM: '_custom'
|
|
75
|
+
};
|
|
76
|
+
const MOUSE_SPECIAL_EVENT_TYPES = [EventType.MOUSEENTER, EventType.MOUSELEAVE, 'pointerenter', 'pointerleave'];
|
|
77
|
+
const BUBBLE_EVENT_TYPES = [EventType.CLICK, EventType.DBLCLICK, EventType.FOCUSIN, EventType.FOCUSOUT, EventType.KEYDOWN, EventType.KEYUP, EventType.KEYPRESS, EventType.MOUSEOVER, EventType.MOUSEOUT, EventType.SUBMIT, EventType.TOUCHSTART, EventType.TOUCHEND, EventType.TOUCHMOVE, 'touchcancel', 'auxclick', 'change', 'compositionstart', 'compositionupdate', 'compositionend', 'beforeinput', 'input', 'select', 'copy', 'cut', 'paste', 'mousedown', 'mouseup', 'wheel', 'contextmenu', 'dragover', 'dragenter', 'dragleave', 'drop', 'dragstart', 'dragend', 'pointerdown', 'pointermove', 'pointerup', 'pointercancel', 'pointerover', 'pointerout', 'gotpointercapture', 'lostpointercapture', 'ended', 'loadedmetadata', 'pagehide', 'pageshow', 'visibilitychange', 'beforematch'];
|
|
78
|
+
const CAPTURE_EVENT_TYPES = [EventType.FOCUS, EventType.BLUR, EventType.ERROR, EventType.LOAD, EventType.TOGGLE];
|
|
79
|
+
const isCaptureEventType = eventType => CAPTURE_EVENT_TYPES.indexOf(eventType) >= 0;
|
|
80
|
+
const EARLY_EVENT_TYPES = BUBBLE_EVENT_TYPES.concat(CAPTURE_EVENT_TYPES);
|
|
81
|
+
const isEarlyEventType = eventType => EARLY_EVENT_TYPES.indexOf(eventType) >= 0;
|
|
82
|
+
|
|
83
|
+
function getBrowserEventType(eventType) {
|
|
84
|
+
if (eventType === EventType.MOUSEENTER) {
|
|
85
|
+
return EventType.MOUSEOVER;
|
|
86
|
+
} else if (eventType === EventType.MOUSELEAVE) {
|
|
87
|
+
return EventType.MOUSEOUT;
|
|
88
|
+
} else if (eventType === EventType.POINTERENTER) {
|
|
89
|
+
return EventType.POINTEROVER;
|
|
90
|
+
} else if (eventType === EventType.POINTERLEAVE) {
|
|
91
|
+
return EventType.POINTEROUT;
|
|
92
|
+
}
|
|
93
|
+
return eventType;
|
|
94
|
+
}
|
|
95
|
+
function addEventListener(element, eventType, handler, passive) {
|
|
96
|
+
let capture = false;
|
|
97
|
+
if (isCaptureEventType(eventType)) {
|
|
98
|
+
capture = true;
|
|
99
|
+
}
|
|
100
|
+
const options = typeof passive === 'boolean' ? {
|
|
101
|
+
capture,
|
|
102
|
+
passive
|
|
103
|
+
} : capture;
|
|
104
|
+
element.addEventListener(eventType, handler, options);
|
|
105
|
+
return {
|
|
106
|
+
eventType,
|
|
107
|
+
handler,
|
|
108
|
+
capture,
|
|
109
|
+
passive
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
function removeEventListener(element, info) {
|
|
113
|
+
if (element.removeEventListener) {
|
|
114
|
+
const options = typeof info.passive === 'boolean' ? {
|
|
115
|
+
capture: info.capture
|
|
116
|
+
} : info.capture;
|
|
117
|
+
element.removeEventListener(info.eventType, info.handler, options);
|
|
118
|
+
} else if (element.detachEvent) {
|
|
119
|
+
element.detachEvent(`on${info.eventType}`, info.handler);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
function preventDefault(e) {
|
|
123
|
+
e.preventDefault ? e.preventDefault() : e.returnValue = false;
|
|
124
|
+
}
|
|
125
|
+
let isMac = typeof navigator !== 'undefined' && /Macintosh/.test(navigator.userAgent);
|
|
126
|
+
function isMiddleClick(e) {
|
|
127
|
+
return (e.which === 2 || e.which == null && e.button === 4
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
function isModifiedClickEvent(e) {
|
|
131
|
+
return (isMac && e.metaKey || !isMac && e.ctrlKey || isMiddleClick(e) || e.shiftKey
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
function isMouseSpecialEvent(e, type, element) {
|
|
135
|
+
const related = e.relatedTarget;
|
|
136
|
+
return (e.type === EventType.MOUSEOVER && type === EventType.MOUSEENTER || e.type === EventType.MOUSEOUT && type === EventType.MOUSELEAVE || e.type === EventType.POINTEROVER && type === EventType.POINTERENTER || e.type === EventType.POINTEROUT && type === EventType.POINTERLEAVE) && (!related || related !== element && !element.contains(related));
|
|
137
|
+
}
|
|
138
|
+
function createMouseSpecialEvent(e, target) {
|
|
139
|
+
const copy = {};
|
|
140
|
+
for (const property in e) {
|
|
141
|
+
if (property === 'srcElement' || property === 'target') {
|
|
142
|
+
continue;
|
|
143
|
+
}
|
|
144
|
+
const key = property;
|
|
145
|
+
const value = e[key];
|
|
146
|
+
if (typeof value === 'function') {
|
|
147
|
+
continue;
|
|
148
|
+
}
|
|
149
|
+
copy[key] = value;
|
|
150
|
+
}
|
|
151
|
+
if (e.type === EventType.MOUSEOVER) {
|
|
152
|
+
copy['type'] = EventType.MOUSEENTER;
|
|
153
|
+
} else if (e.type === EventType.MOUSEOUT) {
|
|
154
|
+
copy['type'] = EventType.MOUSELEAVE;
|
|
155
|
+
} else if (e.type === EventType.POINTEROVER) {
|
|
156
|
+
copy['type'] = EventType.POINTERENTER;
|
|
157
|
+
} else {
|
|
158
|
+
copy['type'] = EventType.POINTERLEAVE;
|
|
159
|
+
}
|
|
160
|
+
copy['target'] = copy['srcElement'] = target;
|
|
161
|
+
copy['bubbles'] = false;
|
|
162
|
+
copy['_originalEvent'] = e;
|
|
163
|
+
return copy;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
const isIos = typeof navigator !== 'undefined' && /iPhone|iPad|iPod/.test(navigator.userAgent);
|
|
167
|
+
class EventContractContainer {
|
|
168
|
+
element;
|
|
169
|
+
handlerInfos = [];
|
|
170
|
+
constructor(element) {
|
|
171
|
+
this.element = element;
|
|
172
|
+
}
|
|
173
|
+
addEventListener(eventType, getHandler, passive) {
|
|
174
|
+
if (isIos) {
|
|
175
|
+
this.element.style.cursor = 'pointer';
|
|
176
|
+
}
|
|
177
|
+
this.handlerInfos.push(addEventListener(this.element, eventType, getHandler(this.element), passive));
|
|
178
|
+
}
|
|
179
|
+
cleanUp() {
|
|
180
|
+
for (let i = 0; i < this.handlerInfos.length; i++) {
|
|
181
|
+
removeEventListener(this.element, this.handlerInfos[i]);
|
|
182
|
+
}
|
|
183
|
+
this.handlerInfos = [];
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
const Char = {
|
|
188
|
+
NAMESPACE_ACTION_SEPARATOR: '.',
|
|
189
|
+
EVENT_ACTION_SEPARATOR: ':'
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
function getEventType(eventInfo) {
|
|
193
|
+
return eventInfo.eventType;
|
|
194
|
+
}
|
|
195
|
+
function setEventType(eventInfo, eventType) {
|
|
196
|
+
eventInfo.eventType = eventType;
|
|
197
|
+
}
|
|
198
|
+
function getEvent(eventInfo) {
|
|
199
|
+
return eventInfo.event;
|
|
200
|
+
}
|
|
201
|
+
function setEvent(eventInfo, event) {
|
|
202
|
+
eventInfo.event = event;
|
|
203
|
+
}
|
|
204
|
+
function getTargetElement(eventInfo) {
|
|
205
|
+
return eventInfo.targetElement;
|
|
206
|
+
}
|
|
207
|
+
function setTargetElement(eventInfo, targetElement) {
|
|
208
|
+
eventInfo.targetElement = targetElement;
|
|
209
|
+
}
|
|
210
|
+
function getContainer(eventInfo) {
|
|
211
|
+
return eventInfo.eic;
|
|
212
|
+
}
|
|
213
|
+
function setContainer(eventInfo, container) {
|
|
214
|
+
eventInfo.eic = container;
|
|
215
|
+
}
|
|
216
|
+
function getTimestamp(eventInfo) {
|
|
217
|
+
return eventInfo.timeStamp;
|
|
218
|
+
}
|
|
219
|
+
function setTimestamp(eventInfo, timestamp) {
|
|
220
|
+
eventInfo.timeStamp = timestamp;
|
|
221
|
+
}
|
|
222
|
+
function getAction(eventInfo) {
|
|
223
|
+
return eventInfo.eia;
|
|
224
|
+
}
|
|
225
|
+
function setAction(eventInfo, actionName, actionElement) {
|
|
226
|
+
eventInfo.eia = [actionName, actionElement];
|
|
227
|
+
}
|
|
228
|
+
function unsetAction(eventInfo) {
|
|
229
|
+
eventInfo.eia = undefined;
|
|
230
|
+
}
|
|
231
|
+
function getActionElement(actionInfo) {
|
|
232
|
+
return actionInfo[1];
|
|
233
|
+
}
|
|
234
|
+
function getIsReplay(eventInfo) {
|
|
235
|
+
return eventInfo.eirp;
|
|
236
|
+
}
|
|
237
|
+
function setIsReplay(eventInfo, replay) {
|
|
238
|
+
eventInfo.eirp = replay;
|
|
239
|
+
}
|
|
240
|
+
function getResolved(eventInfo) {
|
|
241
|
+
return eventInfo.eir;
|
|
242
|
+
}
|
|
243
|
+
function setResolved(eventInfo, resolved) {
|
|
244
|
+
eventInfo.eir = resolved;
|
|
245
|
+
}
|
|
246
|
+
function cloneEventInfo(eventInfo) {
|
|
247
|
+
return {
|
|
248
|
+
eventType: eventInfo.eventType,
|
|
249
|
+
event: eventInfo.event,
|
|
250
|
+
targetElement: eventInfo.targetElement,
|
|
251
|
+
eic: eventInfo.eic,
|
|
252
|
+
eia: eventInfo.eia,
|
|
253
|
+
timeStamp: eventInfo.timeStamp,
|
|
254
|
+
eirp: eventInfo.eirp,
|
|
255
|
+
eiack: eventInfo.eiack,
|
|
256
|
+
eir: eventInfo.eir
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
function createEventInfoFromParameters(eventType, event, targetElement, container, timestamp, action, isReplay, a11yClickKey) {
|
|
260
|
+
return {
|
|
261
|
+
eventType,
|
|
262
|
+
event,
|
|
263
|
+
targetElement,
|
|
264
|
+
eic: container,
|
|
265
|
+
timeStamp: timestamp,
|
|
266
|
+
eia: action,
|
|
267
|
+
eirp: isReplay,
|
|
268
|
+
eiack: a11yClickKey
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
class EventInfoWrapper {
|
|
272
|
+
eventInfo;
|
|
273
|
+
constructor(eventInfo) {
|
|
274
|
+
this.eventInfo = eventInfo;
|
|
275
|
+
}
|
|
276
|
+
getEventType() {
|
|
277
|
+
return getEventType(this.eventInfo);
|
|
278
|
+
}
|
|
279
|
+
setEventType(eventType) {
|
|
280
|
+
setEventType(this.eventInfo, eventType);
|
|
281
|
+
}
|
|
282
|
+
getEvent() {
|
|
283
|
+
return getEvent(this.eventInfo);
|
|
284
|
+
}
|
|
285
|
+
setEvent(event) {
|
|
286
|
+
setEvent(this.eventInfo, event);
|
|
287
|
+
}
|
|
288
|
+
getTargetElement() {
|
|
289
|
+
return getTargetElement(this.eventInfo);
|
|
290
|
+
}
|
|
291
|
+
setTargetElement(targetElement) {
|
|
292
|
+
setTargetElement(this.eventInfo, targetElement);
|
|
293
|
+
}
|
|
294
|
+
getContainer() {
|
|
295
|
+
return getContainer(this.eventInfo);
|
|
296
|
+
}
|
|
297
|
+
setContainer(container) {
|
|
298
|
+
setContainer(this.eventInfo, container);
|
|
299
|
+
}
|
|
300
|
+
getTimestamp() {
|
|
301
|
+
return getTimestamp(this.eventInfo);
|
|
302
|
+
}
|
|
303
|
+
setTimestamp(timestamp) {
|
|
304
|
+
setTimestamp(this.eventInfo, timestamp);
|
|
305
|
+
}
|
|
306
|
+
getAction() {
|
|
307
|
+
const action = getAction(this.eventInfo);
|
|
308
|
+
if (!action) return undefined;
|
|
309
|
+
return {
|
|
310
|
+
name: action[0],
|
|
311
|
+
element: action[1]
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
setAction(action) {
|
|
315
|
+
if (!action) {
|
|
316
|
+
unsetAction(this.eventInfo);
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
319
|
+
setAction(this.eventInfo, action.name, action.element);
|
|
320
|
+
}
|
|
321
|
+
getIsReplay() {
|
|
322
|
+
return getIsReplay(this.eventInfo);
|
|
323
|
+
}
|
|
324
|
+
setIsReplay(replay) {
|
|
325
|
+
setIsReplay(this.eventInfo, replay);
|
|
326
|
+
}
|
|
327
|
+
getResolved() {
|
|
328
|
+
return getResolved(this.eventInfo);
|
|
329
|
+
}
|
|
330
|
+
setResolved(resolved) {
|
|
331
|
+
setResolved(this.eventInfo, resolved);
|
|
332
|
+
}
|
|
333
|
+
clone() {
|
|
334
|
+
return new EventInfoWrapper(cloneEventInfo(this.eventInfo));
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
const EMPTY_ACTION_MAP = {};
|
|
339
|
+
const REGEXP_SEMICOLON = /\s*;\s*/;
|
|
340
|
+
const DEFAULT_EVENT_TYPE = EventType.CLICK;
|
|
341
|
+
class ActionResolver {
|
|
342
|
+
a11yClickSupport = false;
|
|
343
|
+
clickModSupport = true;
|
|
344
|
+
syntheticMouseEventSupport;
|
|
345
|
+
updateEventInfoForA11yClick = undefined;
|
|
346
|
+
preventDefaultForA11yClick = undefined;
|
|
347
|
+
populateClickOnlyAction = undefined;
|
|
348
|
+
constructor({
|
|
349
|
+
syntheticMouseEventSupport = false,
|
|
350
|
+
clickModSupport = true
|
|
351
|
+
} = {}) {
|
|
352
|
+
this.syntheticMouseEventSupport = syntheticMouseEventSupport;
|
|
353
|
+
this.clickModSupport = clickModSupport;
|
|
354
|
+
}
|
|
355
|
+
resolveEventType(eventInfo) {
|
|
356
|
+
if (this.clickModSupport && getEventType(eventInfo) === EventType.CLICK && isModifiedClickEvent(getEvent(eventInfo))) {
|
|
357
|
+
setEventType(eventInfo, EventType.CLICKMOD);
|
|
358
|
+
} else if (this.a11yClickSupport) {
|
|
359
|
+
this.updateEventInfoForA11yClick(eventInfo);
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
resolveAction(eventInfo) {
|
|
363
|
+
if (getResolved(eventInfo)) {
|
|
364
|
+
return;
|
|
365
|
+
}
|
|
366
|
+
this.populateAction(eventInfo, getTargetElement(eventInfo));
|
|
367
|
+
setResolved(eventInfo, true);
|
|
368
|
+
}
|
|
369
|
+
resolveParentAction(eventInfo) {
|
|
370
|
+
const action = getAction(eventInfo);
|
|
371
|
+
const actionElement = action && getActionElement(action);
|
|
372
|
+
unsetAction(eventInfo);
|
|
373
|
+
const parentNode = actionElement && this.getParentNode(actionElement);
|
|
374
|
+
if (!parentNode) {
|
|
375
|
+
return;
|
|
376
|
+
}
|
|
377
|
+
this.populateAction(eventInfo, parentNode);
|
|
378
|
+
}
|
|
379
|
+
populateAction(eventInfo, currentTarget) {
|
|
380
|
+
let actionElement = currentTarget;
|
|
381
|
+
while (actionElement && actionElement !== getContainer(eventInfo)) {
|
|
382
|
+
if (actionElement.nodeType === Node.ELEMENT_NODE) {
|
|
383
|
+
this.populateActionOnElement(actionElement, eventInfo);
|
|
384
|
+
}
|
|
385
|
+
if (getAction(eventInfo)) {
|
|
386
|
+
break;
|
|
387
|
+
}
|
|
388
|
+
actionElement = this.getParentNode(actionElement);
|
|
389
|
+
}
|
|
390
|
+
const action = getAction(eventInfo);
|
|
391
|
+
if (!action) {
|
|
392
|
+
return;
|
|
393
|
+
}
|
|
394
|
+
if (this.a11yClickSupport) {
|
|
395
|
+
this.preventDefaultForA11yClick(eventInfo);
|
|
396
|
+
}
|
|
397
|
+
if (this.syntheticMouseEventSupport) {
|
|
398
|
+
if (getEventType(eventInfo) === EventType.MOUSEENTER || getEventType(eventInfo) === EventType.MOUSELEAVE || getEventType(eventInfo) === EventType.POINTERENTER || getEventType(eventInfo) === EventType.POINTERLEAVE) {
|
|
399
|
+
if (isMouseSpecialEvent(getEvent(eventInfo), getEventType(eventInfo), getActionElement(action))) {
|
|
400
|
+
const copiedEvent = createMouseSpecialEvent(getEvent(eventInfo), getActionElement(action));
|
|
401
|
+
setEvent(eventInfo, copiedEvent);
|
|
402
|
+
setTargetElement(eventInfo, getActionElement(action));
|
|
403
|
+
} else {
|
|
404
|
+
unsetAction(eventInfo);
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
getParentNode(element) {
|
|
410
|
+
const owner = element[Property.OWNER];
|
|
411
|
+
if (owner) {
|
|
412
|
+
return owner;
|
|
413
|
+
}
|
|
414
|
+
const parentNode = element.parentNode;
|
|
415
|
+
if (parentNode?.nodeName === '#document-fragment') {
|
|
416
|
+
return parentNode?.host ?? null;
|
|
417
|
+
}
|
|
418
|
+
return parentNode;
|
|
419
|
+
}
|
|
420
|
+
populateActionOnElement(actionElement, eventInfo) {
|
|
421
|
+
const actionMap = this.parseActions(actionElement);
|
|
422
|
+
const actionName = actionMap[getEventType(eventInfo)];
|
|
423
|
+
if (actionName !== undefined) {
|
|
424
|
+
setAction(eventInfo, actionName, actionElement);
|
|
425
|
+
}
|
|
426
|
+
if (this.a11yClickSupport) {
|
|
427
|
+
this.populateClickOnlyAction(actionElement, eventInfo, actionMap);
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
parseActions(actionElement) {
|
|
431
|
+
let actionMap = get(actionElement);
|
|
432
|
+
if (!actionMap) {
|
|
433
|
+
const jsactionAttribute = actionElement.getAttribute(Attribute.JSACTION);
|
|
434
|
+
if (!jsactionAttribute) {
|
|
435
|
+
actionMap = EMPTY_ACTION_MAP;
|
|
436
|
+
set(actionElement, actionMap);
|
|
437
|
+
} else {
|
|
438
|
+
actionMap = getParsed(jsactionAttribute);
|
|
439
|
+
if (!actionMap) {
|
|
440
|
+
actionMap = {};
|
|
441
|
+
const values = jsactionAttribute.split(REGEXP_SEMICOLON);
|
|
442
|
+
for (let idx = 0; idx < values.length; idx++) {
|
|
443
|
+
const value = values[idx];
|
|
444
|
+
if (!value) {
|
|
445
|
+
continue;
|
|
446
|
+
}
|
|
447
|
+
const colon = value.indexOf(Char.EVENT_ACTION_SEPARATOR);
|
|
448
|
+
const hasColon = colon !== -1;
|
|
449
|
+
const type = hasColon ? value.substr(0, colon).trim() : DEFAULT_EVENT_TYPE;
|
|
450
|
+
const action = hasColon ? value.substr(colon + 1).trim() : value;
|
|
451
|
+
actionMap[type] = action;
|
|
452
|
+
}
|
|
453
|
+
setParsed(jsactionAttribute, actionMap);
|
|
454
|
+
}
|
|
455
|
+
set(actionElement, actionMap);
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
return actionMap;
|
|
459
|
+
}
|
|
460
|
+
addA11yClickSupport(updateEventInfoForA11yClick, preventDefaultForA11yClick, populateClickOnlyAction) {
|
|
461
|
+
this.a11yClickSupport = true;
|
|
462
|
+
this.updateEventInfoForA11yClick = updateEventInfoForA11yClick;
|
|
463
|
+
this.preventDefaultForA11yClick = preventDefaultForA11yClick;
|
|
464
|
+
this.populateClickOnlyAction = populateClickOnlyAction;
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
var Restriction;
|
|
469
|
+
(function (Restriction) {
|
|
470
|
+
Restriction[Restriction["I_AM_THE_JSACTION_FRAMEWORK"] = 0] = "I_AM_THE_JSACTION_FRAMEWORK";
|
|
471
|
+
})(Restriction || (Restriction = {}));
|
|
472
|
+
|
|
473
|
+
class Dispatcher {
|
|
474
|
+
dispatchDelegate;
|
|
475
|
+
actionResolver;
|
|
476
|
+
eventReplayer;
|
|
477
|
+
eventReplayScheduled = false;
|
|
478
|
+
replayEventInfoWrappers = [];
|
|
479
|
+
constructor(dispatchDelegate, {
|
|
480
|
+
actionResolver,
|
|
481
|
+
eventReplayer
|
|
482
|
+
} = {}) {
|
|
483
|
+
this.dispatchDelegate = dispatchDelegate;
|
|
484
|
+
this.actionResolver = actionResolver;
|
|
485
|
+
this.eventReplayer = eventReplayer;
|
|
486
|
+
}
|
|
487
|
+
dispatch(eventInfo) {
|
|
488
|
+
const eventInfoWrapper = new EventInfoWrapper(eventInfo);
|
|
489
|
+
this.actionResolver?.resolveEventType(eventInfo);
|
|
490
|
+
this.actionResolver?.resolveAction(eventInfo);
|
|
491
|
+
const action = eventInfoWrapper.getAction();
|
|
492
|
+
if (action && shouldPreventDefaultBeforeDispatching(action.element, eventInfoWrapper)) {
|
|
493
|
+
preventDefault(eventInfoWrapper.getEvent());
|
|
494
|
+
}
|
|
495
|
+
if (this.eventReplayer && eventInfoWrapper.getIsReplay()) {
|
|
496
|
+
this.scheduleEventInfoWrapperReplay(eventInfoWrapper);
|
|
497
|
+
return;
|
|
498
|
+
}
|
|
499
|
+
this.dispatchDelegate(eventInfoWrapper);
|
|
500
|
+
}
|
|
501
|
+
scheduleEventInfoWrapperReplay(eventInfoWrapper) {
|
|
502
|
+
this.replayEventInfoWrappers.push(eventInfoWrapper);
|
|
503
|
+
if (this.eventReplayScheduled) {
|
|
504
|
+
return;
|
|
505
|
+
}
|
|
506
|
+
this.eventReplayScheduled = true;
|
|
507
|
+
Promise.resolve().then(() => {
|
|
508
|
+
this.eventReplayScheduled = false;
|
|
509
|
+
this.eventReplayer(this.replayEventInfoWrappers);
|
|
510
|
+
});
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
function shouldPreventDefaultBeforeDispatching(actionElement, eventInfoWrapper) {
|
|
514
|
+
return actionElement.tagName === 'A' && (eventInfoWrapper.getEventType() === EventType.CLICK || eventInfoWrapper.getEventType() === EventType.CLICKMOD);
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
const PROPAGATION_STOPPED_SYMBOL = /* @__PURE__ */Symbol.for('propagationStopped');
|
|
518
|
+
const EventPhase = {
|
|
519
|
+
REPLAY: 101
|
|
520
|
+
};
|
|
521
|
+
const PREVENT_DEFAULT_ERROR_MESSAGE_DETAILS = ' Because event replay occurs after browser dispatch, `preventDefault` would have no ' + 'effect. You can check whether an event is being replayed by accessing the event phase: ' + '`event.eventPhase === EventPhase.REPLAY`.';
|
|
522
|
+
const PREVENT_DEFAULT_ERROR_MESSAGE = `\`preventDefault\` called during event replay.`;
|
|
523
|
+
const COMPOSED_PATH_ERROR_MESSAGE_DETAILS = ' Because event replay occurs after browser ' + 'dispatch, `composedPath()` will be empty. Iterate parent nodes from `event.target` or ' + '`event.currentTarget` if you need to check elements in the event path.';
|
|
524
|
+
const COMPOSED_PATH_ERROR_MESSAGE = `\`composedPath\` called during event replay.`;
|
|
525
|
+
class EventDispatcher {
|
|
526
|
+
dispatchDelegate;
|
|
527
|
+
clickModSupport;
|
|
528
|
+
actionResolver;
|
|
529
|
+
dispatcher;
|
|
530
|
+
constructor(dispatchDelegate, clickModSupport = true) {
|
|
531
|
+
this.dispatchDelegate = dispatchDelegate;
|
|
532
|
+
this.clickModSupport = clickModSupport;
|
|
533
|
+
this.actionResolver = new ActionResolver({
|
|
534
|
+
clickModSupport
|
|
535
|
+
});
|
|
536
|
+
this.dispatcher = new Dispatcher(eventInfoWrapper => {
|
|
537
|
+
this.dispatchToDelegate(eventInfoWrapper);
|
|
538
|
+
}, {
|
|
539
|
+
actionResolver: this.actionResolver
|
|
540
|
+
});
|
|
541
|
+
}
|
|
542
|
+
dispatch(eventInfo) {
|
|
543
|
+
this.dispatcher.dispatch(eventInfo);
|
|
544
|
+
}
|
|
545
|
+
dispatchToDelegate(eventInfoWrapper) {
|
|
546
|
+
if (eventInfoWrapper.getIsReplay()) {
|
|
547
|
+
prepareEventForReplay(eventInfoWrapper);
|
|
548
|
+
}
|
|
549
|
+
prepareEventForBubbling(eventInfoWrapper);
|
|
550
|
+
while (eventInfoWrapper.getAction()) {
|
|
551
|
+
prepareEventForDispatch(eventInfoWrapper);
|
|
552
|
+
if (isCaptureEventType(eventInfoWrapper.getEventType()) && eventInfoWrapper.getAction().element !== eventInfoWrapper.getTargetElement()) {
|
|
553
|
+
return;
|
|
554
|
+
}
|
|
555
|
+
this.dispatchDelegate(eventInfoWrapper.getEvent(), eventInfoWrapper.getAction().name);
|
|
556
|
+
if (propagationStopped(eventInfoWrapper)) {
|
|
557
|
+
return;
|
|
558
|
+
}
|
|
559
|
+
this.actionResolver.resolveParentAction(eventInfoWrapper.eventInfo);
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
function prepareEventForBubbling(eventInfoWrapper) {
|
|
564
|
+
const event = eventInfoWrapper.getEvent();
|
|
565
|
+
const originalStopPropagation = eventInfoWrapper.getEvent().stopPropagation.bind(event);
|
|
566
|
+
const stopPropagation = () => {
|
|
567
|
+
event[PROPAGATION_STOPPED_SYMBOL] = true;
|
|
568
|
+
originalStopPropagation();
|
|
569
|
+
};
|
|
570
|
+
patchEventInstance(event, 'stopPropagation', stopPropagation);
|
|
571
|
+
patchEventInstance(event, 'stopImmediatePropagation', stopPropagation);
|
|
572
|
+
}
|
|
573
|
+
function propagationStopped(eventInfoWrapper) {
|
|
574
|
+
const event = eventInfoWrapper.getEvent();
|
|
575
|
+
return !!event[PROPAGATION_STOPPED_SYMBOL];
|
|
576
|
+
}
|
|
577
|
+
function prepareEventForReplay(eventInfoWrapper) {
|
|
578
|
+
const event = eventInfoWrapper.getEvent();
|
|
579
|
+
const target = eventInfoWrapper.getTargetElement();
|
|
580
|
+
const originalPreventDefault = event.preventDefault.bind(event);
|
|
581
|
+
patchEventInstance(event, 'target', target);
|
|
582
|
+
patchEventInstance(event, 'eventPhase', EventPhase.REPLAY);
|
|
583
|
+
patchEventInstance(event, 'preventDefault', () => {
|
|
584
|
+
originalPreventDefault();
|
|
585
|
+
throw new Error(PREVENT_DEFAULT_ERROR_MESSAGE + (ngDevMode ? PREVENT_DEFAULT_ERROR_MESSAGE_DETAILS : ''));
|
|
586
|
+
});
|
|
587
|
+
patchEventInstance(event, 'composedPath', () => {
|
|
588
|
+
throw new Error(COMPOSED_PATH_ERROR_MESSAGE + (ngDevMode ? COMPOSED_PATH_ERROR_MESSAGE_DETAILS : ''));
|
|
589
|
+
});
|
|
590
|
+
}
|
|
591
|
+
function prepareEventForDispatch(eventInfoWrapper) {
|
|
592
|
+
const event = eventInfoWrapper.getEvent();
|
|
593
|
+
const currentTarget = eventInfoWrapper.getAction()?.element;
|
|
594
|
+
if (currentTarget) {
|
|
595
|
+
patchEventInstance(event, 'currentTarget', currentTarget, {
|
|
596
|
+
configurable: true
|
|
597
|
+
});
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
function patchEventInstance(event, property, value, {
|
|
601
|
+
configurable = false
|
|
602
|
+
} = {}) {
|
|
603
|
+
Object.defineProperty(event, property, {
|
|
604
|
+
value,
|
|
605
|
+
configurable
|
|
606
|
+
});
|
|
607
|
+
}
|
|
608
|
+
function registerDispatcher$1(eventContract, dispatcher) {
|
|
609
|
+
eventContract.ecrd(eventInfo => {
|
|
610
|
+
dispatcher.dispatch(eventInfo);
|
|
611
|
+
}, Restriction.I_AM_THE_JSACTION_FRAMEWORK);
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
function createEarlyJsactionData(container) {
|
|
615
|
+
const q = [];
|
|
616
|
+
const d = eventInfo => {
|
|
617
|
+
q.push(eventInfo);
|
|
618
|
+
};
|
|
619
|
+
const h = event => {
|
|
620
|
+
d(createEventInfoFromParameters(event.type, event, event.target, container, Date.now()));
|
|
621
|
+
};
|
|
622
|
+
return {
|
|
623
|
+
c: container,
|
|
624
|
+
q,
|
|
625
|
+
et: [],
|
|
626
|
+
etc: [],
|
|
627
|
+
d,
|
|
628
|
+
h
|
|
629
|
+
};
|
|
630
|
+
}
|
|
631
|
+
function addEvents(earlyJsactionData, types, capture) {
|
|
632
|
+
for (let i = 0; i < types.length; i++) {
|
|
633
|
+
const eventType = types[i];
|
|
634
|
+
const eventTypes = capture ? earlyJsactionData.etc : earlyJsactionData.et;
|
|
635
|
+
eventTypes.push(eventType);
|
|
636
|
+
earlyJsactionData.c.addEventListener(eventType, earlyJsactionData.h, capture);
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
function getQueuedEventInfos(earlyJsactionData) {
|
|
640
|
+
return earlyJsactionData?.q ?? [];
|
|
641
|
+
}
|
|
642
|
+
function registerDispatcher(earlyJsactionData, dispatcher) {
|
|
643
|
+
if (!earlyJsactionData) {
|
|
644
|
+
return;
|
|
645
|
+
}
|
|
646
|
+
earlyJsactionData.d = dispatcher;
|
|
647
|
+
}
|
|
648
|
+
function removeAllEventListeners(earlyJsactionData) {
|
|
649
|
+
if (!earlyJsactionData) {
|
|
650
|
+
return;
|
|
651
|
+
}
|
|
652
|
+
removeEventListeners(earlyJsactionData.c, earlyJsactionData.et, earlyJsactionData.h);
|
|
653
|
+
removeEventListeners(earlyJsactionData.c, earlyJsactionData.etc, earlyJsactionData.h, true);
|
|
654
|
+
}
|
|
655
|
+
function removeEventListeners(container, eventTypes, earlyEventHandler, capture) {
|
|
656
|
+
for (let i = 0; i < eventTypes.length; i++) {
|
|
657
|
+
container.removeEventListener(eventTypes[i], earlyEventHandler, capture);
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
const MOUSE_SPECIAL_SUPPORT = false;
|
|
662
|
+
|
|
663
|
+
class EventContract {
|
|
664
|
+
static MOUSE_SPECIAL_SUPPORT = MOUSE_SPECIAL_SUPPORT;
|
|
665
|
+
containerManager;
|
|
666
|
+
eventHandlers = {};
|
|
667
|
+
browserEventTypeToExtraEventTypes = {};
|
|
668
|
+
dispatcher = null;
|
|
669
|
+
queuedEventInfos = [];
|
|
670
|
+
constructor(containerManager) {
|
|
671
|
+
this.containerManager = containerManager;
|
|
672
|
+
}
|
|
673
|
+
handleEvent(eventType, event, container) {
|
|
674
|
+
const eventInfo = createEventInfoFromParameters(eventType, event, event.target, container, Date.now());
|
|
675
|
+
this.handleEventInfo(eventInfo);
|
|
676
|
+
}
|
|
677
|
+
handleEventInfo(eventInfo) {
|
|
678
|
+
if (!this.dispatcher) {
|
|
679
|
+
setIsReplay(eventInfo, true);
|
|
680
|
+
this.queuedEventInfos?.push(eventInfo);
|
|
681
|
+
return;
|
|
682
|
+
}
|
|
683
|
+
this.dispatcher(eventInfo);
|
|
684
|
+
}
|
|
685
|
+
addEvent(eventType, prefixedEventType, passive) {
|
|
686
|
+
if (eventType in this.eventHandlers || !this.containerManager) {
|
|
687
|
+
return;
|
|
688
|
+
}
|
|
689
|
+
if (!EventContract.MOUSE_SPECIAL_SUPPORT && MOUSE_SPECIAL_EVENT_TYPES.indexOf(eventType) >= 0) {
|
|
690
|
+
return;
|
|
691
|
+
}
|
|
692
|
+
const eventHandler = (eventType, event, container) => {
|
|
693
|
+
this.handleEvent(eventType, event, container);
|
|
694
|
+
};
|
|
695
|
+
this.eventHandlers[eventType] = eventHandler;
|
|
696
|
+
const browserEventType = getBrowserEventType(prefixedEventType || eventType);
|
|
697
|
+
if (browserEventType !== eventType) {
|
|
698
|
+
const eventTypes = this.browserEventTypeToExtraEventTypes[browserEventType] || [];
|
|
699
|
+
eventTypes.push(eventType);
|
|
700
|
+
this.browserEventTypeToExtraEventTypes[browserEventType] = eventTypes;
|
|
701
|
+
}
|
|
702
|
+
this.containerManager.addEventListener(browserEventType, element => {
|
|
703
|
+
return event => {
|
|
704
|
+
eventHandler(eventType, event, element);
|
|
705
|
+
};
|
|
706
|
+
}, passive);
|
|
707
|
+
}
|
|
708
|
+
replayEarlyEvents(earlyJsactionData = window._ejsa) {
|
|
709
|
+
if (!earlyJsactionData) {
|
|
710
|
+
return;
|
|
711
|
+
}
|
|
712
|
+
this.replayEarlyEventInfos(earlyJsactionData.q);
|
|
713
|
+
removeAllEventListeners(earlyJsactionData);
|
|
714
|
+
delete window._ejsa;
|
|
715
|
+
}
|
|
716
|
+
replayEarlyEventInfos(earlyEventInfos) {
|
|
717
|
+
for (let i = 0; i < earlyEventInfos.length; i++) {
|
|
718
|
+
const earlyEventInfo = earlyEventInfos[i];
|
|
719
|
+
const eventTypes = this.getEventTypesForBrowserEventType(earlyEventInfo.eventType);
|
|
720
|
+
for (let j = 0; j < eventTypes.length; j++) {
|
|
721
|
+
const eventInfo = cloneEventInfo(earlyEventInfo);
|
|
722
|
+
setEventType(eventInfo, eventTypes[j]);
|
|
723
|
+
this.handleEventInfo(eventInfo);
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
getEventTypesForBrowserEventType(browserEventType) {
|
|
728
|
+
const eventTypes = [];
|
|
729
|
+
if (this.eventHandlers[browserEventType]) {
|
|
730
|
+
eventTypes.push(browserEventType);
|
|
731
|
+
}
|
|
732
|
+
if (this.browserEventTypeToExtraEventTypes[browserEventType]) {
|
|
733
|
+
eventTypes.push(...this.browserEventTypeToExtraEventTypes[browserEventType]);
|
|
734
|
+
}
|
|
735
|
+
return eventTypes;
|
|
736
|
+
}
|
|
737
|
+
handler(eventType) {
|
|
738
|
+
return this.eventHandlers[eventType];
|
|
739
|
+
}
|
|
740
|
+
cleanUp() {
|
|
741
|
+
this.containerManager?.cleanUp();
|
|
742
|
+
this.containerManager = null;
|
|
743
|
+
this.eventHandlers = {};
|
|
744
|
+
this.browserEventTypeToExtraEventTypes = {};
|
|
745
|
+
this.dispatcher = null;
|
|
746
|
+
this.queuedEventInfos = [];
|
|
747
|
+
}
|
|
748
|
+
registerDispatcher(dispatcher, restriction) {
|
|
749
|
+
this.ecrd(dispatcher, restriction);
|
|
750
|
+
}
|
|
751
|
+
ecrd(dispatcher, restriction) {
|
|
752
|
+
this.dispatcher = dispatcher;
|
|
753
|
+
if (this.queuedEventInfos?.length) {
|
|
754
|
+
for (let i = 0; i < this.queuedEventInfos.length; i++) {
|
|
755
|
+
this.handleEventInfo(this.queuedEventInfos[i]);
|
|
756
|
+
}
|
|
757
|
+
this.queuedEventInfos = null;
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
function bootstrapAppScopedEarlyEventContract(container, appId, bubbleEventTypes, captureEventTypes, dataContainer = window) {
|
|
763
|
+
const earlyJsactionData = createEarlyJsactionData(container);
|
|
764
|
+
if (!dataContainer._ejsas) {
|
|
765
|
+
dataContainer._ejsas = {};
|
|
766
|
+
}
|
|
767
|
+
dataContainer._ejsas[appId] = earlyJsactionData;
|
|
768
|
+
addEvents(earlyJsactionData, bubbleEventTypes);
|
|
769
|
+
addEvents(earlyJsactionData, captureEventTypes, true);
|
|
770
|
+
}
|
|
771
|
+
function getAppScopedQueuedEventInfos(appId, dataContainer = window) {
|
|
772
|
+
return getQueuedEventInfos(dataContainer._ejsas?.[appId]);
|
|
773
|
+
}
|
|
774
|
+
function registerAppScopedDispatcher(restriction, appId, dispatcher, dataContainer = window) {
|
|
775
|
+
registerDispatcher(dataContainer._ejsas?.[appId], dispatcher);
|
|
776
|
+
}
|
|
777
|
+
function removeAllAppScopedEventListeners(appId, dataContainer = window) {
|
|
778
|
+
removeAllEventListeners(dataContainer._ejsas?.[appId]);
|
|
779
|
+
}
|
|
780
|
+
function clearAppScopedEarlyEventContract(appId, dataContainer = window) {
|
|
781
|
+
if (!dataContainer._ejsas) {
|
|
782
|
+
return;
|
|
783
|
+
}
|
|
784
|
+
dataContainer._ejsas[appId] = undefined;
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
export { Attribute, EventContract, EventContractContainer, EventDispatcher, EventInfoWrapper, EventPhase, bootstrapAppScopedEarlyEventContract, clearAppScopedEarlyEventContract, getDefaulted as getActionCache, getAppScopedQueuedEventInfos, isCaptureEventType, isEarlyEventType, registerAppScopedDispatcher, registerDispatcher$1 as registerDispatcher, removeAllAppScopedEventListeners };
|
|
788
|
+
//# sourceMappingURL=primitives-event-dispatch.mjs.map
|