@lvce-editor/virtual-dom 1.11.0 → 1.13.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.
- package/dist/index.js +12 -2
- package/package.json +1 -1
- package/src/parts/AttachEvent/AttachEvent.ts +1 -1
- package/src/parts/CreateEventListenerFunction/CreateEventListenerFunction.ts +4 -0
- package/src/parts/GetEventListenerArg/GetEventListenerArg.ts +2 -0
- package/src/parts/GetEventListenerOptions/GetEventListenerOptions.ts +6 -1
package/dist/index.js
CHANGED
|
@@ -220,7 +220,12 @@ var getElementTag = (type) => {
|
|
|
220
220
|
};
|
|
221
221
|
|
|
222
222
|
// src/parts/GetEventListenerOptions/GetEventListenerOptions.ts
|
|
223
|
-
var getEventListenerOptions = (eventName) => {
|
|
223
|
+
var getEventListenerOptions = (eventName, value) => {
|
|
224
|
+
if (value.passive) {
|
|
225
|
+
return {
|
|
226
|
+
passive: true
|
|
227
|
+
};
|
|
228
|
+
}
|
|
224
229
|
switch (eventName) {
|
|
225
230
|
case "wheel":
|
|
226
231
|
return {
|
|
@@ -323,7 +328,7 @@ var attachEvent = ($Node, eventMap, key, value, newEventMap) => {
|
|
|
323
328
|
console.warn("listener not found", value);
|
|
324
329
|
return;
|
|
325
330
|
}
|
|
326
|
-
const options = getEventListenerOptions(key);
|
|
331
|
+
const options = getEventListenerOptions(key, value);
|
|
327
332
|
const wrapped = getWrappedListener(
|
|
328
333
|
listener,
|
|
329
334
|
eventMap.returnValue
|
|
@@ -552,6 +557,8 @@ var getEventListenerArg = (param, event) => {
|
|
|
552
557
|
return event.deltaY;
|
|
553
558
|
case "event.detail":
|
|
554
559
|
return event.detail;
|
|
560
|
+
case "event.target.name":
|
|
561
|
+
return event.target.name;
|
|
555
562
|
default:
|
|
556
563
|
return param;
|
|
557
564
|
}
|
|
@@ -581,6 +588,9 @@ var createFn = (info) => {
|
|
|
581
588
|
ipc.send("Viewlet.executeViewletCommand", uid, ...args);
|
|
582
589
|
};
|
|
583
590
|
nameAnonymousFunction(fn, info.name);
|
|
591
|
+
if (info.passive) {
|
|
592
|
+
fn.passive = true;
|
|
593
|
+
}
|
|
584
594
|
return fn;
|
|
585
595
|
};
|
|
586
596
|
|
package/package.json
CHANGED
|
@@ -18,7 +18,7 @@ export const attachEvent = (
|
|
|
18
18
|
console.warn('listener not found', value)
|
|
19
19
|
return
|
|
20
20
|
}
|
|
21
|
-
const options = GetEventListenerOptions.getEventListenerOptions(key)
|
|
21
|
+
const options = GetEventListenerOptions.getEventListenerOptions(key, value)
|
|
22
22
|
const wrapped = GetWrappedListener.getWrappedListener(
|
|
23
23
|
listener,
|
|
24
24
|
eventMap.returnValue,
|
|
@@ -17,5 +17,9 @@ export const createFn = (info) => {
|
|
|
17
17
|
ipc.send('Viewlet.executeViewletCommand', uid, ...args)
|
|
18
18
|
}
|
|
19
19
|
NameAnonymousFunction.nameAnonymousFunction(fn, info.name)
|
|
20
|
+
if (info.passive) {
|
|
21
|
+
// TODO avoid mutating function property, maybe return an object with function and options
|
|
22
|
+
fn.passive = true
|
|
23
|
+
}
|
|
20
24
|
return fn
|
|
21
25
|
}
|