@lvce-editor/virtual-dom 1.12.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 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
@@ -583,6 +588,9 @@ var createFn = (info) => {
583
588
  ipc.send("Viewlet.executeViewletCommand", uid, ...args);
584
589
  };
585
590
  nameAnonymousFunction(fn, info.name);
591
+ if (info.passive) {
592
+ fn.passive = true;
593
+ }
586
594
  return fn;
587
595
  };
588
596
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/virtual-dom",
3
- "version": "1.12.0",
3
+ "version": "1.13.0",
4
4
  "main": "dist/index.js",
5
5
  "type": "module",
6
6
  "keywords": [],
@@ -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
  }
@@ -1,4 +1,9 @@
1
- export const getEventListenerOptions = (eventName: string) => {
1
+ export const getEventListenerOptions = (eventName: string, value: any) => {
2
+ if (value.passive) {
3
+ return {
4
+ passive: true,
5
+ }
6
+ }
2
7
  switch (eventName) {
3
8
  case 'wheel':
4
9
  return {